Skip to content

DOMException should be subclass of Error #1854

Open
@inexorabletash

Description

@inexorabletash

Per http://heycam.github.io/webidl/#es-exception-objects and http://heycam.github.io/webidl/#es-DOMException-prototype-object DOMException should be a subclass of Error and therefore have name and message properties.

Sample:

/** @param {DOMException} error */
function showError(error) {
  console.log(error.name);
  console.log(error.message);
}

Closure Compiler service reports:

JSC_INEXISTENT_PROPERTY: Property name never defined on DOMException at line 3 character 20
  console.log(error.name);
                    ^
JSC_INEXISTENT_PROPERTY: Property message never defined on DOMException at line 4 character 20
  console.log(error.message);
                    ^

Also note that code is intended to be an own-property not necessarily a getter on the prototype, but this is not clearly specified at the moment, and browsers (e.g. Chrome) may implement it as an inherited getter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions