Browse Source

Propagate error during loading of STL files via onError callback

Matthias Baumann 7 years ago
parent
commit
ca6eb12182
1 changed files with 14 additions and 1 deletions
  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 );