|
@@ -82,13 +82,14 @@ class DRACOLoader extends Loader {
|
|
|
|
|
|
}
|
|
|
|
|
|
- parse( buffer, onLoad, onError ) {
|
|
|
+
|
|
|
+ parse( buffer, onLoad, onError = ()=>{} ) {
|
|
|
|
|
|
this.decodeDracoFile( buffer, onLoad, null, null, SRGBColorSpace ).catch( onError );
|
|
|
|
|
|
}
|
|
|
|
|
|
- decodeDracoFile( buffer, callback, attributeIDs, attributeTypes, vertexColorSpace = LinearSRGBColorSpace ) {
|
|
|
+ decodeDracoFile( buffer, callback, attributeIDs, attributeTypes, vertexColorSpace = LinearSRGBColorSpace, onError = () => {} ) {
|
|
|
|
|
|
const taskConfig = {
|
|
|
attributeIDs: attributeIDs || this.defaultAttributeIDs,
|
|
@@ -97,7 +98,7 @@ class DRACOLoader extends Loader {
|
|
|
vertexColorSpace: vertexColorSpace,
|
|
|
};
|
|
|
|
|
|
- return this.decodeGeometry( buffer, taskConfig ).then( callback );
|
|
|
+ return this.decodeGeometry( buffer, taskConfig ).then( callback ).catch( onError );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -156,7 +157,12 @@ class DRACOLoader extends Loader {
|
|
|
} );
|
|
|
|
|
|
} )
|
|
|
- .then( ( message ) => this._createGeometry( message.geometry ) );
|
|
|
+ .then( ( message ) => this._createGeometry( message.geometry ) )
|
|
|
+ .catch( ( error ) => {
|
|
|
+
|
|
|
+ throw new Error( error );
|
|
|
+
|
|
|
+ } );
|
|
|
|
|
|
// Remove task from the task list.
|
|
|
// Note: replaced '.finally()' with '.catch().then()' block - iOS 11 support (#19416)
|