Skip to content

A library to create a series of common errors or custom erros. (Released) (Category: back-end)

License

Notifications You must be signed in to change notification settings

Betterez/btrz-errors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

btrz-errors

A library to create a series of common or custom errors

It wraps the make-error-cause library and offers some conventions on top of it.

Usage

let BtrzErrors = require("btrz-errors").BtrzErrors;

let error = BtrzErrors.create("NEW_ERROR"); //Only a code, no message or causing error

let errorWithCause = BtrzErrors.create("WITH_CAUSE", err);
// Will return an error of type WithCause that holds the err in the .cause === err

let errorWithMessage = BtrzErrors.create("WITH_MESSAGE", "this is the message")
// will return an error of type WithMessage with the .message === "this is the message"

let complete = BtrzErrors.create("COMPLETE", err, "message");
// will return an error of type "Complete"
// .message === "message"
// .name === "Complete"
// .cause === err

About

A library to create a series of common errors or custom erros. (Released) (Category: back-end)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published