Skip to content

Consider removing InternalError #1516

Closed

Description

@saghul

It's non-standard: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/InternalError

None of the major server runtimes implement it. As for browsers, only Firefox has it.

Proposal: replace it with a plain Error and drop the custom type.

/cc @bnoordhuis

Activity

  1. bnoordhuis commented on May 26, 2026

    @bnoordhuis
    Contributor

    We use InternalError when the engine breaks down and I don't think it's a good idea to confabulate that kind of error with regular runtime exceptions.

    If the idea is to not confuse JS land with non-standard exceptions, then maybe it's better to make it uncatchable.

  2. saghul commented on May 26, 2026

    @saghul
    ContributorAuthor

    That was part of the idea yeah.

    I took a stab at it in the linked PR, following some practices that other engines seem to do. Things like memory error should likely not be that?

    Do you think it's worth it to go with with a fine comb and reduce the usage?

  3. bnoordhuis commented on May 26, 2026

    @bnoordhuis
    Contributor

    I count 31 uses of JS_ThrowInternalError, 3 which might be better as a different kind of exception (2x stack overflow, 1x string too long.)

    The deserializer throws InternalError in a number of cases but that seems perfectly fine to me, that's non-standard functionality in the first place.

  4. bnoordhuis commented on May 26, 2026

    @bnoordhuis
    Contributor

    ...although looking in more detail at the stack overflow exceptions, they're indicative of corrupted bytecode, so InternalError is likely appropriate after all.

  5. saghul commented on May 26, 2026

    @saghul
    ContributorAuthor

    What does v8 do in similar cases?

  6. bnoordhuis commented on May 26, 2026

    @bnoordhuis
    Contributor

    Abort :)

  7. saghul commented on May 26, 2026

    @saghul
    ContributorAuthor

    👍 I'm dropping this then.

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

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions