Closed Tilican closed 1 year ago
You should be catching the exception in the interpreted code, not in the code invoking the interpreter:
const myCode = `
try {
modules('hello', 'say', [1,3,"azezaee"]);
} catch (e) {
// handle e
}
`
Also, on this line:
callback(interpreter.throwException(interpreter.TYPE_ERROR, 'Something went bad !'))
you do not need (and should not call) callback
. As it happens, throwException
actually throw
s an exception which means that callback
will not actually be called, but if that were not the case it would still suffice to call throwException
, and calling callback
would actually cause unexpected and undesirable behaviour.
hey,
I'm using JS-Interpreter for custom scripting on my app :)
But i need to throw an exception from async :/
I try that
But i can't catch it with ...
I got
Thx :D