Socket
Socket
Sign inDemoInstall

domexception

Package Overview
Dependencies
Maintainers
6
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

domexception

An implementation of the DOMException class from browsers


Version published
Weekly downloads
15M
decreased by-18.9%
Maintainers
6
Weekly downloads
 
Created

What is domexception?

The domexception npm package provides a way to create DOMException objects, which represent exceptions that occur while interacting with the Document Object Model (DOM). This package is particularly useful when working with DOM-like structures in non-browser environments, such as Node.js, where the DOMException global is not available by default.

What are domexception's main functionalities?

Creating a new DOMException

This feature allows you to create a new DOMException object with a custom error message and name. The name should be one of the DOMException error names, such as 'NotFoundError', 'SyntaxError', etc.

const DOMException = require('domexception');
const exception = new DOMException('Error message', 'NotFoundError');

Checking the instance of DOMException

This feature is useful for checking if a given object is an instance of DOMException, which can be helpful for error handling and debugging.

const exception = new DOMException('Error message', 'NotFoundError');
console.log(exception instanceof DOMException); // true

Other packages similar to domexception

Keywords

FAQs

Package last updated on 03 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc