-
Notifications
You must be signed in to change notification settings - Fork 448
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
v12-alpha: The raise call started recreating exn, which breaks try/catch #6929
Comments
I think we can change let raiseError = str => raise(Failure(str)) |
There is no idiomatic way to throw other errors like |
Something we can support is exception name as error name. exception EvalError(string)
raise(EvalError("foo")) compile to: throw new EvalError("foo", {
cause: {
RE_EXN_ID: "EvalError",
_1: "foo"
}
}); |
That's not the point. How we throw an error doesn't matter since it might come from an unexpected runtime exception. It still shouldn't break in the case. If the code is in Js_dump, I can probably fix it myself. |
This is how I see the solution for the issue #6933 |
I can implement it myself during the week |
Since it accepts the
exn
type, I expect it to simply generatethrow exn
instead of recreating an exception instance, which might break onexn
having a Js error.v11: https://rescript-lang.org/try?version=v11.1.3&code=C4JwngBA3gUBECkDOA6AogDwHYpAQwEskBTNEEAexAAoAiAMwotoEoYBfCAYz2C4AtoMAD4Ri2CAF4AfBHxFi1cVjbsYMcV2IAHYAQpYIAFWJJg60JFjx5JaibOruvAUNHKps24uWqgA
v12: https://rescript-lang.org/try?version=v12.0.0-alpha.1&code=C4JwngBA3gUBECkDOA6AogDwHYpAQwEskBTNEEAexAAoAiAMwotoEoYBfCAYz2C4AtoMAD4Ri2CAF4AfBHxFi1cVjbsYMcV2IAHYAQpYIAFWJJg60JFjx5JaibOruvAUNHKps24uWqgA
The text was updated successfully, but these errors were encountered: