|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | # DOMException
|
|---|
| 2 |
|
|---|
| 3 | 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/tmpvar/jsdom) and related packages.
|
|---|
| 4 |
|
|---|
| 5 | Example usage:
|
|---|
| 6 |
|
|---|
| 7 | ```js
|
|---|
| 8 | const DOMException = require("domexception");
|
|---|
| 9 |
|
|---|
| 10 | const e1 = new DOMException("Something went wrong", "BadThingsError");
|
|---|
| 11 | console.assert(e1.name === "BadThingsError");
|
|---|
| 12 | console.assert(e1.code === 0);
|
|---|
| 13 |
|
|---|
| 14 | const e2 = new DOMException("Another exciting error message", "NoModificationAllowedError");
|
|---|
| 15 | console.assert(e2.name === "NoModificationAllowedError");
|
|---|
| 16 | console.assert(e2.code === 7);
|
|---|
| 17 |
|
|---|
| 18 | console.assert(DOMException.INUSE_ATTRIBUTE_ERR === 10);
|
|---|
| 19 | ```
|
|---|
| 20 |
|
|---|
| 21 | ## APIs
|
|---|
| 22 |
|
|---|
| 23 | This package exposes two flavors of the `DOMException` interface depending on the imported module.
|
|---|
| 24 |
|
|---|
| 25 | ### `domexception` module
|
|---|
| 26 |
|
|---|
| 27 | This module default-exports the `DOMException` interface constructor.
|
|---|
| 28 |
|
|---|
| 29 | ### `domexception/webidl2js-wrapper` module
|
|---|
| 30 |
|
|---|
| 31 | This module exports the `DOMException` [interface wrapper API](https://github.com/jsdom/webidl2js#for-interfaces) generated by [webidl2js](https://github.com/jsdom/webidl2js).
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.