Explorar o código

Propagate error during loading of STL files via onError callback

Matthias Baumann %!s(int64=7) %!d(string=hai) anos
pai
achega
ca6eb12182
Modificáronse 1 ficheiros con 14 adicións e 1 borrados
  1. 14 1
      examples/js/loaders/STLLoader.js

+ 14 - 1
examples/js/loaders/STLLoader.js

@@ -48,7 +48,20 @@ THREE.STLLoader.prototype = {
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+		    try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( exception ) {
+
+		        if ( onError ) {
+
+		            onError( exception );
+
+				}
+
+		    }
+
 
 		}, onProgress, onError );