# domexception

> An implementation of the DOMException class from browsers

Latest version **4.0.0** (published 2021-10-06) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install domexception
pnpm add domexception
yarn add domexception
bun add domexception
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2021-10-06 |
| First published | 2017-08-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/domexception) |
| Module format | CommonJS |
| Node | >=12 |
| Dependencies | 1 |
| Unpacked size | 19.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 22 |
| Author | Domenic Denicola |
| Maintainers | timothygu, domenic, sebmaster, zirro, tmpvar, joris-van-der-wel |
| Keywords | dom, webidl, web idl, domexception, error, exception |

## Links

- npm: https://www.npmjs.com/package/domexception
- Repository: https://github.com/jsdom/domexception
- Homepage: https://github.com/jsdom/domexception#readme
- Issues: https://github.com/jsdom/domexception/issues
- npm.io page: https://npm.io/package/domexception

## Dependencies (1)

- [webidl-conversions](https://npm.io/package/webidl-conversions.md) ^7.0.0

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 4.0.0 (latest) — 2021-10-06
- 3.0.0 — 2021-10-03
- 2.0.1 — 2019-12-14
- 2.0.0 — 2019-12-07
- 1.0.1 — 2018-01-22
- 1.0.0 — 2017-08-14

## README

# DOMException

This package implements the [`DOMException`](https://heycam.github.io/webidl/#idl-DOMException) class, from web browsers. It exists in service of [jsdom](https://github.com/jsdom/jsdom) and related packages.

Example usage:

```js
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);
```

## APIs

This package exposes two flavors of the `DOMException` interface depending on the imported module.

### `domexception` module

This module default-exports the `DOMException` interface constructor.

### `domexception/webidl2js-wrapper` module

This module exports the `DOMException` [interface wrapper API](https://github.com/jsdom/webidl2js#for-interfaces) generated by [webidl2js](https://github.com/jsdom/webidl2js).

---
_Source: https://npm.io/package/domexception · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
