@peassoft/verror
v1.0.0
Published
Extanded JavaScript error
Readme
@peassoft/verror
JavaScript error class extended with:
- custom
nameproperty; - optional
infoobject.
Installation
$ npm install @peassoft/verrorUsage example
import VError from '@peassoft/verror';
const originalError = new Error('foo');
const err = new VError(
{
name: 'MyCustomError,
cause: originalError,
info: {
anyField1: 'bar',
anyField2: 1,
},
},
'error message',
);API Reference
constructor(opts, message)
opts- Options bucket:opts.name: string- Custom error name.opts.cause?: Error- Optional. AnErrorobject that caused the constructed Error.opts.info?: Record<string, unknown>- Optional. A bucket for any additional information describing the context of the constructed error.
message: string- Error message.
