@nick-bull/create-error

0.4.0 • Public • Published

A utility for creating errors

Installation

npm i @nick-bull/create-error

Usage

const options = {
  type: 'error:badThing',
  message: (payload) => `An error message for ${payload.user}!`,
  messageContext: {user: 'you'},
};
const message = 'An error message';

try {
  throw Error('Undefined definition definitely directly demonstrably due to 0x234235');
}
catch (error) {
  const createdError = createError(options, error);
  console.log(createdError.trace);
}

Readme

Keywords

Package Sidebar

Install

npm i @nick-bull/create-error

Weekly Downloads

11

Version

0.4.0

License

ISC

Unpacked Size

64.7 kB

Total Files

20

Last publish

Collaborators

  • nick-bull