Explorar el Código

Propagate error during loading of STL files via onError callback

Matthias Baumann hace 7 años
padre
commit
ca6eb12182
Se han modificado 1 ficheros con 14 adiciones y 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 );