Jump to content

No error messages in callback functions


Fedor
 Share

Recommended Posts

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?

 

 

 

 

Link to comment
Share on other sites

  • 3 weeks later...

@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);

 }
);

 

Link to comment
Share on other sites

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. 

 

Link to comment
Share on other sites

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:

  1. the model is loaded and the callback fires
  2. The first alert is shown. Click it.
  3. 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.
  4. 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...

 

Link to comment
Share on other sites

@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, :P 
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

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...