Browse Source

Handle onerror callback in BABYLON.SceneLoader.ImportMesh

The onerror callback wasn't being properly handled.
Mohamed Mansour 8 years ago
parent
commit
1cf1db4a41
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/Loading/babylon.sceneLoader.ts

+ 5 - 1
src/Loading/babylon.sceneLoader.ts

@@ -209,7 +209,11 @@
 
 
                 Tools.LoadFile(rootUrl + sceneFilename, data => {
                 Tools.LoadFile(rootUrl + sceneFilename, data => {
                     importMeshFromData(data);
                     importMeshFromData(data);
-                }, progressCallBack, database, useArrayBuffer);
+                }, progressCallBack, database, useArrayBuffer, () => {
+                    if (onerror) {
+                        onerror(scene, 'Unable to load file ' + rootUrl + sceneFilename)
+                    }
+                });
             };
             };
 
 
             if (scene.getEngine().enableOfflineSupport && !directLoad) {
             if (scene.getEngine().enableOfflineSupport && !directLoad) {