Error handling
Method errors
If your JavaScript method contains throws errors when executing, the $methoderror
callback is called with a row parameter which contains two columns:
errorCode column contains the error code of the error.
errorInfo column contains information about the error.
You can use the errorCode and errorInfo columns to debug your JavaScript method.
Worker errors
If the JavaScript worker has failed to start, the $workererror
callback is called with a row parameter which contains two columns:
errorCode column contains the error code of the error.
errorInfo column contains information about the error.
These errors are unlikely to be caused by the method called, but more likely issues with Node.js itself e.g. a crash.
Registering callbacks
If you inherited your JavaScript worker, you can simply override callbacks in your new object.
Otherwise, if you created a new variable with the object type of OW3 JavaScript worker, you will need to register the instance that will receive the callbacks such as $methoderror
, $workererror
and $methodreturn
.
You can do so by assigning the instance to the $callbackinst
property, for example:
Do jsWorker.$callbackinst.$assign($cinst)
Will assign the callback instance to $cinst
(current instance). If $cinst
is a window, then that window class must implement the methods $methoderror
, $workererror
and $methodreturn
.
Methods and properties
To view all methods and properties of the OW3 JavaScript Worker, please consult the online documentation available here.