Closed
Description
The current exception objects are encoded as below:
throw {
RE_EXN_ID: "Assert_failure",
_1: [
"tscanf_test.ml",
174,
2
],
Error: new Error()
};
This gives us good stacktrace when it is uncaught, but it does not work well with existing js toolchains. For example, mocha will catch such exception, and check the stack
property which does not exist (we hit similar internal issues before). I am proposing to tweak it to the below one:
throw (Object.assign( new Error, {
RE_EXN_ID: "Assert_failure", // needed for internal marker
message : "Assert_failure", // to make default printing idiomatic
_1: [
"tscanf_test.ml",
174,
2
]
})
This data representation should work better with existing js toolset.
TODO: make sure nullary exception, e.g, Not_found work as expected.
Cons: it seems the payload _1
not printed by default in this case
Metadata
Metadata
Assignees
Labels
No labels