Problem
In V0.7.4 if you don't register a listener to catch errors, then
your fatal SceneJS errors will appear in the console as "[object,
object]", which is a SceneJS exception instance. Futhermore,
exceptions were being thrown from within SceneJS's error handler,
not from the actual place where the exception occurred.
Solution
Have the handler return the exception message,
for the caller to then throw as an exception:
...
if (!params.uri) {
throw SceneJS_errorModule.fatalError(new SceneJS.NodeConfigExpectedException("SceneJS.Load parameter expected: uri"));
}
...
To be able to tie the exception back to information in
documentation, prefix the exception message with the SceneJS
exception class name:
SceneJS.InvalidNodeConfigException = function(msg, cause) {
this.message="SceneJS.InvalidNodeConfigException: " + msg ;
this.cause = cause;
};