8000 Add an Error type · Issue #6 · dominikh/go-js-dom · GitHub
[go: up one dir, main page]

Skip to content

Add an Error type #6

Open
Open

Description

@dominikh

Add a type Error, which acts as a combination of DOMException and DOMError. It should be returned from methods such as (*HTMLInputElement).StepDown, which are documented to throw exceptions in case of abnormal conditions.

When we catch an exception that isn't of type DOMException¹, we should throw it again, as it's of a different nature.

We should also consider adding one variable per possible error type (e.g. InvalidStateError), so that one can check directly against those, instead of requiring more constants and comparing fields of Error to those.

Finally, find out whether all modern browsers have the name property, or if we need to implement a fallback that looks at code instead.

¹: Only DOMException will actually be thrown, DOMError is some internal name.
²: https://developer.mozilla.org/en-US/docs/Web/API/DOMError and https://developer.mozilla.org/en/docs/Web/API/DOMException will serve as guidance.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0