Skip to content

Conversation

@thecharhan
Copy link
Contributor

The current GLTFLoader behavior will silently fail with an uncaught promise rejection if an error (say, a bad buffer file load) happens while parsing a node. This change should propagate such errors up to the user's onError function.

var nodeDef = json.nodes[ nodeIndex ];

return new Promise( function ( resolve ) {
return function( ) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we'll need to reorganize this a little at some point — would be nice to flatten it and avoid the IIFE here, and also see #14875. But this looks like an improvement for now. 👍

Copy link
Collaborator

Choose a reason for hiding this comment

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

actually, for now could you just wrap the IIFE in parentheses, with no space between the ()?

( function() {
  // ...
}() )

I find that makes it easier to see we've returned a promise, not a function. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks!

Copy link
Collaborator

@donmccurdy donmccurdy left a comment

Choose a reason for hiding this comment

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

@mrdoob mrdoob added this to the r100 milestone Dec 3, 2018
@mrdoob mrdoob merged commit 1cd938a into mrdoob:dev Dec 3, 2018
@mrdoob
Copy link
Owner

mrdoob commented Dec 3, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants