-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't throw in functions #9
Comments
I've tracked it to function DEBUG_FUNCTION_CALL, where theres a try catch ... |
I'm working on it |
Errors shouldn't be suppressed anymore with 3edc548 |
I think "throw" outside a try should generate an Iroh.PROGRAM "exception" event That way you can listen for it and get the source location and maybe even a call stack. |
This would require to patch a let stage = new Iroh.Stage(code);
stage.addListener(Iroh.PROGRAM)
.on("error", (e) => {
console.error(e.error);
});
try {
eval(stage.script);
} catch (e) {
let event = stage.createEvent(Iroh.PROGRAM_ERROR);
event.indent = stage.indent;
event.error = e;
event.trigger("error");
} So if you want to listen for uncatched errors in your program, you have to evaluate your program this way, which remains global support but requires some additional code lines. |
Example code:
`
const Iroh = require("iroh");
let stage = new Iroh.Stage(
function foo() { throw "banana"; } foo();
);eval(stage.script);
`
The exception will be ignored!
The text was updated successfully, but these errors were encountered: