Skip to content

v12-alpha: The raise call started recreating exn, which breaks try/catch #6929

Closed

Activity

  1. aspeddro commented on Aug 3, 2024

    @aspeddro
    Contributor

    I think we can change Js.Exn.raiseError function to:

    let raiseError = str => raise(Failure(str))

    Playground

  2. aspeddro commented on Aug 3, 2024

    @aspeddro
    Contributor

    There is no idiomatic way to throw other errors like EvalError. In fact, there never was.

  3. aspeddro commented on Aug 4, 2024

    @aspeddro
    Contributor

    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"
            }
          });
  4. DZakh commented on Aug 4, 2024

    @DZakh
    MemberAuthor

    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.

  5. DZakh commented on Aug 4, 2024

    @DZakh
    MemberAuthor

    This is how I see the solution for the issue #6933

  6. DZakh commented on Aug 4, 2024

    @DZakh
    MemberAuthor

    I can implement it myself during the week

  7. added this to the v12 milestone on Aug 25, 2024
  8. cknitt commented on May 11, 2025

    @cknitt
    Member

    This was fixed in #7016 by reverting #6611.

    Closing this issue, as there is already a separate one for a custom ReScriptError class: #6972

  9. added theissue type on Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions