domexception
Advanced tools
An implementation of the DOMException class from browsers
Weekly downloads
Changelog
4.0.0
The breaking changes in this version are to the API exported by the domexception/webidl2js-wrapper
module. In particular it now is based on webidl2js
v17, which changes some of the exported function signatures, and changes the realms of any errors thrown on misuse.
Readme
This package implements the DOMException
class, from web browsers. It exists in service of jsdom and related packages.
Example usage:
const DOMException = require("domexception");
const e1 = new DOMException("Something went wrong", "BadThingsError");
console.assert(e1.name === "BadThingsError");
console.assert(e1.code === 0);
const e2 = new DOMException("Another exciting error message", "NoModificationAllowedError");
console.assert(e2.name === "NoModificationAllowedError");
console.assert(e2.code === 7);
console.assert(DOMException.INUSE_ATTRIBUTE_ERR === 10);
This package exposes two flavors of the DOMException
interface depending on the imported module.
domexception
moduleThis module default-exports the DOMException
interface constructor.
domexception/webidl2js-wrapper
moduleThis module exports the DOMException
interface wrapper API generated by webidl2js.
An implementation of the DOMException class from browsers
The npm package domexception receives a total of 16,504,615 weekly downloads. As such, domexception popularity was classified as popular.
We found that domexception demonstrated a healthy version release cadence and project activity. It has 6 open source maintainers collaborating on the project.