creates a new Error
with the given name
and message
.
givenError
which will have concatenated message
and stack
with the newly created error.givenError
is not typeof Error
an Error
will be created of it.const existingError = new RangeError('some message')
const myError = new NamedError('MyError', 'this is my custom Error', existingError);
// in a try-catch-phrase
try {
// some dangerous stuff
} catch (error) {
Loxer.error(new NamedError('DangerousStuffError', 'failed to do some dangerous stuff', error));
}
The Error.name
The Error.message
which may be concatenated with the givenError.message
An optional error (of any type) which will be concatenated
Optional override for formatting stack traces
Create .stack property on a target object
Generated using TypeDoc
A customizable Error, that may be created from an existing Error