Fedor Posted May 9, 2017 Share Posted May 9, 2017 Hi, Does anybody know why I am not getting error messages in callback functions like the callback of ImportMesh? It breaks somehow without telling the console why. This is not standard JS or browser behaviour. Can I somehow turn on error messages? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 9, 2017 Share Posted May 9, 2017 Hello, can you reproduce the issue in the playground? It is impossible to help you without more details Quote Link to comment Share on other sites More sharing options...
Fedor Posted May 27, 2017 Author Share Posted May 27, 2017 Sorry for my late response, I'll have try... never worked with playgrounds so have to dive into it... Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted May 27, 2017 Share Posted May 27, 2017 @Fedor Hi, Are you using the correct callback? Please see this; http://playground.babylonjs.com/#SSRM6S it throws a error intentionally, see console More info; The ImportMesh function has three callbacks, 1; returning the mesh data when loaded, 2; returning loading progress, and 3; returning errors. // Using .babylon name "skull2" (should be "skull"). returns a "unable to load..." error for the purpose of this example. BABYLON.SceneLoader.ImportMesh( "", "scenes/", "skull2.babylon", scene, function (newMeshes) { // This callback returns the loaded meshes, particle systems, skeletons. }, function (progress) { // This callback returns the loading progress of the .babylon file. Can be null. }, function(scene, err, exc){ // This callback returns any errors and/or exceptions encountered while trying to load the .babylon file. Can be null. console.log(err, exc); } ); Quote Link to comment Share on other sites More sharing options...
Fedor Posted May 27, 2017 Author Share Posted May 27, 2017 Hi, I think I did not make myself clear: it is the onsucces callback I don't get any error messages from - it does fire but if any error happens inside the function itself, it just breaks with no message at all. Quote Link to comment Share on other sites More sharing options...
Fedor Posted May 27, 2017 Author Share Posted May 27, 2017 Ok, I have made this playground: http://www.babylonjs-playground.com/index2_5.html#X31WKD#3 Please, read past the loading errors. I have not set up this web server properly, but it does not matter too much. This is what happens: the model is loaded and the callback fires The first alert is shown. Click it. The script tries to set an non existing element in a non existing array. I would expect to see an error message in the javascript console that says something about arrays and me being a sloppy programmer. But it doesn't. The script stops, never reaching the second alert. You will not see it on your screen. Where is my error message? Stupid that you only miss it when it's gone... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 29, 2017 Share Posted May 29, 2017 This is because the whole callback is ran inside a try catch block: https://github.com/BabylonJS/Babylon.js/blob/master/src/Loading/babylon.sceneLoader.ts#L173 Fedor 1 Quote Link to comment Share on other sites More sharing options...
Fedor Posted June 2, 2017 Author Share Posted June 2, 2017 ah... ok. Thanks. I'll figure out another way to debug these functions, or just keep out of them as much as possible. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted June 2, 2017 Share Posted June 2, 2017 @Fedor You can simply throw it inside your own try .. catch http://www.babylonjs-playground.com/index2_5.html#X31WKD#5 Quote ReferenceError: testdummy is not defined at myCallback (eval at compileAndRun (3dc215ab164dd64cca1bffa01e1ff72706b4aefa.js:404), <anonymous>:25:9) at _ (958e27b….js:17) at 958e27b….js:17 at XMLHttpRequest.e.onreadystatechange (958e27b….js:3) Or if you had followed my previous post, add a error callback and the same error will be passed as the exc variable (exceptions) http://www.babylonjs-playground.com/index2_5.html#X31WKD#6 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.