JSPM

error-code-domain

1.0.5
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q25351F
  • License MIT

Javascript 'Error object' with code and domain properties

Package Exports

  • error-code-domain

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (error-code-domain) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

error-code-domain

Javascript 'Error object' with code and domain properties

Sample:


//file: test.js
const ErrorWithCode = require("error-code-domain")("TEST");

try {
  throw ErrorWithCode(-4000, "this is message");
} catch (error) {
  console.log(error);
}

Console:

{ Error: 
    at ErrorWithCode (/***/error-code-domain/index.js:5:23)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3) 
  code: -4000, 
  domain: 'TEST' 
  message: 'this is message'
}