Skip to content

Commit

Permalink
catch correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
slimbuck committed Nov 13, 2024
1 parent 00e2f02 commit e34154d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/framework/parsers/ply.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,14 +552,15 @@ class PlyParser {
* @param {Asset} asset - Container asset.
*/
async load(url, callback, asset) {
const response = await fetch(url.load);
if (!response || !response.body) {
callback('Error loading resource', null);
} else {
readPly(response.body.getReader(), asset.data.elementFilter ?? defaultElementFilter)
.then((gsplatData) => {
try {
const response = await fetch(url.load);
if (!response || !response.body) {
callback('Error loading resource', null);
} else {
const gsplatData = await readPly(response.body.getReader(), asset.data.elementFilter ?? defaultElementFilter);

// reorder data
if (!gsplatData.isCompressed) {
// reorder data
if (asset.data.reorder ?? true) {
gsplatData.reorderData();
}
Expand All @@ -572,10 +573,9 @@ class PlyParser {
);

callback(null, resource);
})
.catch((err) => {
callback(err, null);
});
}
} catch (err) {
callback(err, null);
}
}

Expand Down

0 comments on commit e34154d

Please sign in to comment.