Error Conditions
Error processing
Julia exceptions are detected when they occur and are propagated to the JavaScript runtime. Also, there are fairly few error that can occur before control is handed over to Julia; these errors are also propagated. All three execution type primitives eval, exec as well as Script.exec share this same behavior.
Error Messages
During an asynchronous call, Julia exceptions and node-julia exceptions are propagated to JavaScript via error message. These are simply the message strings relevant to the error. If no error occurs, then null is returned.
- julia.func(arguments,function(err,result1,result2...) { // <--- err will be non-null if an error occurs
Exceptions
During a synchronous call, Julia exceptions are caught and then re-thrown as JavaScript exceptions. There is currently a somewhat simplistic mapping in place to relate similar type exceptions. If a Julia exception is caught that does not have a translation, the catchall is a generic Javascript error.
An unknown method
julia.exec('foo',1,2,3);
^
ReferenceError: Julia method foo is undefined
at ReferenceError (native)
at Object.<anonymous> (/Users/jeffw/src/nj-test3/test3.js:5:7)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:349:32)
at Function.Module._load (module.js:305:12)
at Function.Module.runMain (module.js:490:10)
at startup (node.js:124:16)
at node.js:807:3
By comparison a known function, but invoked with the wrong arguments
julia.exec('inv',1,2,3);
^
ReferenceError: Julia unmatched method inv(Int64,Int64,Int64)
at ReferenceError (native)
A general error
julia.eval('(*!@&$(*&@$*(!@&$(*&@');
^
Error: Julia syntax: missing separator in tuple
at Error (native)
Updated less than a minute ago