Преглед изворни кода

Merge pull request #19466 from Mugen87/dev49

Loaders: Improve error handling.
Mr.doob пре 5 година
родитељ
комит
999d819e16
53 измењених фајлова са 945 додато и 71 уклоњено
  1. 19 1
      examples/js/loaders/3MFLoader.js
  2. 19 1
      examples/js/loaders/AMFLoader.js
  3. 19 1
      examples/js/loaders/AssimpLoader.js
  4. 19 1
      examples/js/loaders/BVHLoader.js
  5. 19 1
      examples/js/loaders/ColladaLoader.js
  6. 9 5
      examples/js/loaders/FBXLoader.js
  7. 19 1
      examples/js/loaders/GCodeLoader.js
  8. 19 1
      examples/js/loaders/KMZLoader.js
  9. 19 1
      examples/js/loaders/MD2Loader.js
  10. 19 1
      examples/js/loaders/MTLLoader.js
  11. 19 1
      examples/js/loaders/NRRDLoader.js
  12. 19 1
      examples/js/loaders/OBJLoader.js
  13. 3 1
      examples/js/loaders/PCDLoader.js
  14. 19 1
      examples/js/loaders/PDBLoader.js
  15. 19 1
      examples/js/loaders/PLYLoader.js
  16. 19 1
      examples/js/loaders/PRWMLoader.js
  17. 8 2
      examples/js/loaders/STLLoader.js
  18. 19 1
      examples/js/loaders/SVGLoader.js
  19. 19 1
      examples/js/loaders/TDSLoader.js
  20. 19 1
      examples/js/loaders/TTFLoader.js
  21. 19 1
      examples/js/loaders/VRMLLoader.js
  22. 19 1
      examples/js/loaders/VRMLoader.js
  23. 19 1
      examples/js/loaders/VTKLoader.js
  24. 19 1
      examples/js/loaders/XLoader.js
  25. 19 1
      examples/jsm/loaders/3MFLoader.js
  26. 19 1
      examples/jsm/loaders/AMFLoader.js
  27. 19 1
      examples/jsm/loaders/AssimpLoader.js
  28. 19 1
      examples/jsm/loaders/BVHLoader.js
  29. 19 1
      examples/jsm/loaders/ColladaLoader.js
  30. 9 5
      examples/jsm/loaders/FBXLoader.js
  31. 19 1
      examples/jsm/loaders/GCodeLoader.js
  32. 19 1
      examples/jsm/loaders/KMZLoader.js
  33. 21 1
      examples/jsm/loaders/LWOLoader.js
  34. 19 1
      examples/jsm/loaders/MD2Loader.js
  35. 19 1
      examples/jsm/loaders/MTLLoader.js
  36. 19 1
      examples/jsm/loaders/NRRDLoader.js
  37. 19 1
      examples/jsm/loaders/OBJLoader.js
  38. 3 1
      examples/jsm/loaders/PCDLoader.js
  39. 19 1
      examples/jsm/loaders/PDBLoader.js
  40. 19 1
      examples/jsm/loaders/PLYLoader.js
  41. 19 1
      examples/jsm/loaders/PRWMLoader.js
  42. 8 2
      examples/jsm/loaders/STLLoader.js
  43. 19 1
      examples/jsm/loaders/SVGLoader.js
  44. 19 1
      examples/jsm/loaders/TDSLoader.js
  45. 19 1
      examples/jsm/loaders/TTFLoader.js
  46. 19 1
      examples/jsm/loaders/VRMLLoader.js
  47. 19 1
      examples/jsm/loaders/VRMLoader.js
  48. 19 1
      examples/jsm/loaders/VTKLoader.js
  49. 19 1
      examples/jsm/loaders/XLoader.js
  50. 19 1
      src/loaders/AnimationLoader.js
  51. 29 9
      src/loaders/AudioLoader.js
  52. 19 1
      src/loaders/BufferGeometryLoader.js
  53. 19 1
      src/loaders/MaterialLoader.js

+ 19 - 1
examples/js/loaders/3MFLoader.js

@@ -38,7 +38,25 @@ THREE.ThreeMFLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( buffer ) {
 
-			onLoad( scope.parse( buffer ) );
+			try {
+
+				onLoad( scope.parse( buffer ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/AMFLoader.js

@@ -37,7 +37,25 @@ THREE.AMFLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+			try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/AssimpLoader.js

@@ -24,7 +24,25 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 
 		loader.load( url, function ( buffer ) {
 
-			onLoad( scope.parse( buffer, path ) );
+			try {
+
+				onLoad( scope.parse( buffer, path ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/BVHLoader.js

@@ -29,7 +29,25 @@ THREE.BVHLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+			try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/ColladaLoader.js

@@ -23,7 +23,25 @@ THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text, path ) );
+			try {
+
+				onLoad( scope.parse( text, path ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 9 - 5
examples/js/loaders/FBXLoader.js

@@ -51,15 +51,19 @@ THREE.FBXLoader = ( function () {
 
 					onLoad( scope.parse( buffer, path ) );
 
-				} catch ( error ) {
+				} catch ( e ) {
 
-					setTimeout( function () {
+					if ( onError ) {
 
-						if ( onError ) onError( error );
+						onError( e );
 
-						scope.manager.itemError( url );
+					} else {
+
+						console.error( e );
+
+					}
 
-					}, 0 );
+					scope.manager.itemError( url );
 
 				}
 

+ 19 - 1
examples/js/loaders/GCodeLoader.js

@@ -29,7 +29,25 @@ THREE.GCodeLoader.prototype = Object.assign( Object.create( THREE.Loader.prototy
 		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+			try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/KMZLoader.js

@@ -21,7 +21,25 @@ THREE.KMZLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+			try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/MD2Loader.js

@@ -21,7 +21,25 @@ THREE.MD2Loader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( buffer ) {
 
-			onLoad( scope.parse( buffer ) );
+			try {
+
+				onLoad( scope.parse( buffer ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/MTLLoader.js

@@ -37,7 +37,25 @@ THREE.MTLLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 		loader.setPath( this.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text, path ) );
+			try {
+
+				onLoad( scope.parse( text, path ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/NRRDLoader.js

@@ -21,7 +21,25 @@ THREE.NRRDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototyp
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( data ) {
 
-			onLoad( scope.parse( data ) );
+			try {
+
+				onLoad( scope.parse( data ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/OBJLoader.js

@@ -439,7 +439,25 @@ THREE.OBJLoader = ( function () {
 			loader.setPath( this.path );
 			loader.load( url, function ( text ) {
 
-				onLoad( scope.parse( text ) );
+				try {
+
+					onLoad( scope.parse( text ) );
+
+				} catch ( e ) {
+
+					if ( onError ) {
+
+						onError( e );
+
+					} else {
+
+						console.error( e );
+
+					}
+
+					scope.manager.itemError( url );
+
+				}
 
 			}, onProgress, onError );
 

+ 3 - 1
examples/js/loaders/PCDLoader.js

@@ -39,10 +39,12 @@ THREE.PCDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 				} else {
 
-					throw e;
+					console.error( e );
 
 				}
 
+				scope.manager.itemError( url );
+
 			}
 
 		}, onProgress, onError );

+ 19 - 1
examples/js/loaders/PDBLoader.js

@@ -21,7 +21,25 @@ THREE.PDBLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+			try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/PLYLoader.js

@@ -48,7 +48,25 @@ THREE.PLYLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+			try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/PRWMLoader.js

@@ -244,7 +244,25 @@ THREE.PRWMLoader = ( function () {
 
 			loader.load( url, function ( arrayBuffer ) {
 
-				onLoad( scope.parse( arrayBuffer ) );
+				try {
+
+					onLoad( scope.parse( arrayBuffer ) );
+
+				} catch ( e ) {
+
+					if ( onError ) {
+
+						onError( e );
+
+					} else {
+
+						console.error( e );
+
+					}
+
+					scope.manager.itemError( url );
+
+				}
 
 			}, onProgress, onError );
 

+ 8 - 2
examples/js/loaders/STLLoader.js

@@ -79,14 +79,20 @@ THREE.STLLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 				onLoad( scope.parse( text ) );
 
-			} catch ( exception ) {
+			} catch ( e ) {
 
 				if ( onError ) {
 
-					onError( exception );
+					onError( e );
+
+				} else {
+
+					console.error( e );
 
 				}
 
+				scope.manager.itemError( url );
+
 			}
 
 		}, onProgress, onError );

+ 19 - 1
examples/js/loaders/SVGLoader.js

@@ -28,7 +28,25 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+			try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/TDSLoader.js

@@ -48,7 +48,25 @@ THREE.TDSLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 		loader.load( url, function ( data ) {
 
-			onLoad( scope.parse( data, path ) );
+			try {
+
+				onLoad( scope.parse( data, path ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/TTFLoader.js

@@ -30,7 +30,25 @@ THREE.TTFLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( buffer ) {
 
-			onLoad( scope.parse( buffer ) );
+			try {
+
+				onLoad( scope.parse( buffer ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/VRMLLoader.js

@@ -36,7 +36,25 @@ THREE.VRMLLoader = ( function () {
 			loader.setPath( scope.path );
 			loader.load( url, function ( text ) {
 
-				onLoad( scope.parse( text, path ) );
+				try {
+
+					onLoad( scope.parse( text, path ) );
+
+				} catch ( e ) {
+
+					if ( onError ) {
+
+						onError( e );
+
+					} else {
+
+						console.error( e );
+
+					}
+
+					scope.manager.itemError( url );
+
+				}
 
 			}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/VRMLoader.js

@@ -33,7 +33,25 @@ THREE.VRMLoader = ( function () {
 
 			this.gltfLoader.load( url, function ( gltf ) {
 
-				scope.parse( gltf, onLoad );
+				try {
+
+					scope.parse( gltf, onLoad );
+
+				} catch ( e ) {
+
+					if ( onError ) {
+
+						onError( e );
+
+					} else {
+
+						console.error( e );
+
+					}
+
+					scope.manager.itemError( url );
+
+				}
 
 			}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/VTKLoader.js

@@ -28,7 +28,25 @@ THREE.VTKLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+			try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/js/loaders/XLoader.js

@@ -285,7 +285,25 @@ THREE.XLoader = ( function () {
 				loader.setResponseType( 'arraybuffer' );
 				loader.load( this.url, function ( response ) {
 
-					_this.parse( response, onLoad );
+					try {
+
+						_this.parse( response, onLoad );
+
+					} catch ( e ) {
+
+						if ( onError ) {
+
+							onError( e );
+
+						} else {
+
+							console.error( e );
+
+						}
+
+						_this.manager.itemError( _this.url );
+
+					}
 
 				}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/3MFLoader.js

@@ -62,7 +62,25 @@ ThreeMFLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( buffer ) {
 
-			onLoad( scope.parse( buffer ) );
+			try {
+
+				onLoad( scope.parse( buffer ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/AMFLoader.js

@@ -50,7 +50,25 @@ AMFLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+			try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/AssimpLoader.js

@@ -44,7 +44,25 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		loader.load( url, function ( buffer ) {
 
-			onLoad( scope.parse( buffer, path ) );
+			try {
+
+				onLoad( scope.parse( buffer, path ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/BVHLoader.js

@@ -41,7 +41,25 @@ BVHLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+			try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/ColladaLoader.js

@@ -63,7 +63,25 @@ ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text, path ) );
+			try {
+
+				onLoad( scope.parse( text, path ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 9 - 5
examples/jsm/loaders/FBXLoader.js

@@ -98,15 +98,19 @@ var FBXLoader = ( function () {
 
 					onLoad( scope.parse( buffer, path ) );
 
-				} catch ( error ) {
+				} catch ( e ) {
 
-					setTimeout( function () {
+					if ( onError ) {
 
-						if ( onError ) onError( error );
+						onError( e );
 
-						scope.manager.itemError( url );
+					} else {
+
+						console.error( e );
+
+					}
 
-					}, 0 );
+					scope.manager.itemError( url );
 
 				}
 

+ 19 - 1
examples/jsm/loaders/GCodeLoader.js

@@ -40,7 +40,25 @@ GCodeLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+			try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/KMZLoader.js

@@ -30,7 +30,25 @@ KMZLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+			try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 21 - 1
examples/jsm/loaders/LWOLoader.js

@@ -76,7 +76,27 @@ LWOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.load( url, function ( buffer ) {
 
 			// console.time( 'Total parsing: ' );
-			onLoad( scope.parse( buffer, path, modelName ) );
+
+			try {
+
+				onLoad( scope.parse( buffer, path, modelName ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
+
 			// console.timeEnd( 'Total parsing: ' );
 
 		}, onProgress, onError );

+ 19 - 1
examples/jsm/loaders/MD2Loader.js

@@ -30,7 +30,25 @@ MD2Loader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( buffer ) {
 
-			onLoad( scope.parse( buffer ) );
+			try {
+
+				onLoad( scope.parse( buffer ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/MTLLoader.js

@@ -50,7 +50,25 @@ MTLLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.setPath( this.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text, path ) );
+			try {
+
+				onLoad( scope.parse( text, path ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/NRRDLoader.js

@@ -30,7 +30,25 @@ NRRDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( data ) {
 
-			onLoad( scope.parse( data ) );
+			try {
+
+				onLoad( scope.parse( data ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/OBJLoader.js

@@ -455,7 +455,25 @@ var OBJLoader = ( function () {
 			loader.setPath( this.path );
 			loader.load( url, function ( text ) {
 
-				onLoad( scope.parse( text ) );
+				try {
+
+					onLoad( scope.parse( text ) );
+
+				} catch ( e ) {
+
+					if ( onError ) {
+
+						onError( e );
+
+					} else {
+
+						console.error( e );
+
+					}
+
+					scope.manager.itemError( url );
+
+				}
 
 			}, onProgress, onError );
 

+ 3 - 1
examples/jsm/loaders/PCDLoader.js

@@ -49,10 +49,12 @@ PCDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 				} else {
 
-					throw e;
+					console.error( e );
 
 				}
 
+				scope.manager.itemError( url );
+
 			}
 
 		}, onProgress, onError );

+ 19 - 1
examples/jsm/loaders/PDBLoader.js

@@ -28,7 +28,25 @@ PDBLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+			try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/PLYLoader.js

@@ -56,7 +56,25 @@ PLYLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+			try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/PRWMLoader.js

@@ -251,7 +251,25 @@ var PRWMLoader = ( function () {
 
 			loader.load( url, function ( arrayBuffer ) {
 
-				onLoad( scope.parse( arrayBuffer ) );
+				try {
+
+					onLoad( scope.parse( arrayBuffer ) );
+
+				} catch ( e ) {
+
+					if ( onError ) {
+
+						onError( e );
+
+					} else {
+
+						console.error( e );
+
+					}
+
+					scope.manager.itemError( url );
+
+				}
 
 			}, onProgress, onError );
 

+ 8 - 2
examples/jsm/loaders/STLLoader.js

@@ -89,14 +89,20 @@ STLLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 				onLoad( scope.parse( text ) );
 
-			} catch ( exception ) {
+			} catch ( e ) {
 
 				if ( onError ) {
 
-					onError( exception );
+					onError( e );
+
+				} else {
+
+					console.error( e );
 
 				}
 
+				scope.manager.itemError( url );
+
 			}
 
 		}, onProgress, onError );

+ 19 - 1
examples/jsm/loaders/SVGLoader.js

@@ -40,7 +40,25 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+			try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/TDSLoader.js

@@ -64,7 +64,25 @@ TDSLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		loader.load( url, function ( data ) {
 
-			onLoad( scope.parse( data, path ) );
+			try {
+
+				onLoad( scope.parse( data, path ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/TTFLoader.js

@@ -36,7 +36,25 @@ TTFLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( buffer ) {
 
-			onLoad( scope.parse( buffer ) );
+			try {
+
+				onLoad( scope.parse( buffer ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/VRMLLoader.js

@@ -74,7 +74,25 @@ var VRMLLoader = ( function () {
 			loader.setPath( scope.path );
 			loader.load( url, function ( text ) {
 
-				onLoad( scope.parse( text, path ) );
+				try {
+
+					onLoad( scope.parse( text, path ) );
+
+				} catch ( e ) {
+
+					if ( onError ) {
+
+						onError( e );
+
+					} else {
+
+						console.error( e );
+
+					}
+
+					scope.manager.itemError( url );
+
+				}
 
 			}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/VRMLoader.js

@@ -38,7 +38,25 @@ var VRMLoader = ( function () {
 
 			this.gltfLoader.load( url, function ( gltf ) {
 
-				scope.parse( gltf, onLoad );
+				try {
+
+					scope.parse( gltf, onLoad );
+
+				} catch ( e ) {
+
+					if ( onError ) {
+
+						onError( e );
+
+					} else {
+
+						console.error( e );
+
+					}
+
+					scope.manager.itemError( url );
+
+				}
 
 			}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/VTKLoader.js

@@ -38,7 +38,25 @@ VTKLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( text ) );
+			try {
+
+				onLoad( scope.parse( text ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
examples/jsm/loaders/XLoader.js

@@ -307,7 +307,25 @@ var XLoader = ( function () {
 				loader.setResponseType( 'arraybuffer' );
 				loader.load( this.url, function ( response ) {
 
-					_this.parse( response, onLoad );
+					try {
+
+						_this.parse( response, onLoad );
+
+					} catch ( e ) {
+
+						if ( onError ) {
+
+							onError( e );
+
+						} else {
+
+							console.error( e );
+
+						}
+
+						_this.manager.itemError( _this.url );
+
+					}
 
 				}, onProgress, onError );
 

+ 19 - 1
src/loaders/AnimationLoader.js

@@ -24,7 +24,25 @@ AnimationLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( JSON.parse( text ) ) );
+			try {
+
+				onLoad( scope.parse( JSON.parse( text ) ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 29 - 9
src/loaders/AudioLoader.js

@@ -18,21 +18,41 @@ AudioLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	load: function ( url, onLoad, onProgress, onError ) {
 
-		var loader = new FileLoader( this.manager );
+		var scope = this;
+
+		var loader = new FileLoader( scope.manager );
 		loader.setResponseType( 'arraybuffer' );
-		loader.setPath( this.path );
+		loader.setPath( scope.path );
 		loader.load( url, function ( buffer ) {
 
-			// Create a copy of the buffer. The `decodeAudioData` method
-			// detaches the buffer when complete, preventing reuse.
-			var bufferCopy = buffer.slice( 0 );
+			try {
+
+				// Create a copy of the buffer. The `decodeAudioData` method
+				// detaches the buffer when complete, preventing reuse.
+				var bufferCopy = buffer.slice( 0 );
+
+				var context = AudioContext.getContext();
+				context.decodeAudioData( bufferCopy, function ( audioBuffer ) {
+
+					onLoad( audioBuffer );
+
+				} );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
 
-			var context = AudioContext.getContext();
-			context.decodeAudioData( bufferCopy, function ( audioBuffer ) {
+				}
 
-				onLoad( audioBuffer );
+				scope.manager.itemError( url );
 
-			} );
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
src/loaders/BufferGeometryLoader.js

@@ -29,7 +29,25 @@ BufferGeometryLoader.prototype = Object.assign( Object.create( Loader.prototype
 		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( JSON.parse( text ) ) );
+			try {
+
+				onLoad( scope.parse( JSON.parse( text ) ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );
 

+ 19 - 1
src/loaders/MaterialLoader.js

@@ -32,7 +32,25 @@ MaterialLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( scope.parse( JSON.parse( text ) ) );
+			try {
+
+				onLoad( scope.parse( JSON.parse( text ) ) );
+
+			} catch ( e ) {
+
+				if ( onError ) {
+
+					onError( e );
+
+				} else {
+
+					console.error( e );
+
+				}
+
+				scope.manager.itemError( url );
+
+			}
 
 		}, onProgress, onError );