I've encountered a challenge while using a JSONLoader in Three.js - specifically, I'm unsure about how to handle errors that may arise during the model loading process.
Here is an example of my code:
// create a new loader
var loader = new THREE.JSONLoader();
// load the resource
loader.load(
// specify the resource URL
'models/animated/monster/monster.js',
// The callback function upon successful resource loading
function ( geometry, materials ) {
var material = new THREE.MultiMaterial( materials );
var object = new THREE.Mesh( geometry, material );
scene.add( object );
}
);
In the event that the resource is not found, the load operation fails but the callback function does not get triggered. Since it appears that there is no provision for an error callback function and using a "try catch" method won't work due to its asynchronous nature, how can I detect when this load operation fails and respond accordingly?