Native DOMException migration helpers for JavaScript and TypeScript.
domexception is deprecated because modern runtimes expose DOMException directly. This package default-exports the native constructor for migration compatibility and adds small typed helpers for converting and checking errors.
npm install dom-exception-modernimport DOMException, { createDOMException, isDOMException } from "dom-exception-modern";
const error = new DOMException("Cannot modify this value", "NoModificationAllowedError");
if (isDOMException(error)) {
console.log(error.code);
}
createDOMException("Aborted", "AbortError");The runtime's native DOMException constructor.
Creates a native DOMException.
Checks whether a value behaves like a DOMException.
Converts unknown thrown values to DOMException.
Named legacy constants from the native constructor.
dom-exception-modern is an independent alternative or migration helper for projects moving away from domexception. It is not affiliated with the original package maintainers or project.
For release context, see the local migration guide, examples, compatibility notes, source metadata, and adoption plan.