JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 35194287
  • Score
    100M100P100Q229127F

A library to make errors.

Package Exports

  • makeerror

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 (makeerror) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

makeerror

A library to make errors. Makes an Error constructor function with the signature:

function(message, data)

You'll typically do something like:

var makeError = require('makeerror')
var UnknownFileTypeError = makeError(
  'UnknownFileTypeError',
  'The specified type is not known.'
)
var er = UnknownFileTypeError()

er will have a prototype chain that ensures:

er instanceof Error
er instanceof UnknownFileTypeError

You can also do var er = new UnknownFileTypeError() if you really like the new keyword.