Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USDZLoader: throw error instead of warning #28685

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions examples/jsm/loaders/USDZLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ class USDZLoader extends Loader {

if ( isCrateFile( zip[ filename ] ) ) {

console.warn( 'THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.' );
continue;
throw Error( 'THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.' );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think throwing an error is indeed more helpful than just logging a warning. In this way, the app can better handle the situation.


}

Expand Down Expand Up @@ -242,12 +241,10 @@ class USDZLoader extends Loader {

if ( isCrate ) {

console.warn( 'THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.' );
throw Error( 'THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.' );

}

return undefined;

}

const zip = fflate.unzipSync( new Uint8Array( buffer ) );
Expand All @@ -260,15 +257,6 @@ class USDZLoader extends Loader {

const file = findUSD( zip );

if ( file === undefined ) {

console.warn( 'THREE.USDZLoader: No usda file found.' );

return new Group();

}


// Parse file

const text = fflate.strFromU8( file );
Expand Down