• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
aspectrr

aspectrr

steel-perplexity-starter

Public
Like
steel-perplexity-starter
Home
Code
4
node_modules
44
src
main.ts
new-file-8776.ts
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
node_modules
/
node-domexception
/
.history
/
README_20210527214408.md
Code
/
node_modules
/
node-domexception
/
.history
/
README_20210527214408.md
Search
11/18/2025
Viewing readonly version of main branch: v898
View latest version
README_20210527214408.md

DOMException

An implementation of the DOMException class from NodeJS

This package exposes the DOMException class that comes from NodeJS itself. (including all of the deprecated legacy codes) NodeJS has it built in, but it's not globally available, and you can't require/import it from somewhere.

The only possible way is to use some web-ish tools that have been introduced into NodeJS that throws an error and catch the constructor. This way you will have the same class that NodeJS has and you can check if the error is a instance of DOMException. The instanceof check would not have worked with a custom class such as the DOMException provided by domenic which also is much larger in size since it has to re-construct the hole class from the ground up.

(plz don't depend on this package in any other environment other than node >=10.5)

Create val
import DOMException from 'node-domexception' import { MessageChannel } from 'worker_threads' async function hello() { const port = new MessageChannel().port1 const ab = new ArrayBuffer() port.postMessage(ab, [ab, ab]) } hello().catch(err => { console.assert(err.name === 'DataCloneError') console.assert(err.code === 25) console.assert(err instanceof 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)
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.