Better Errors library provides a BetterError
class based on the standard Error
class. It extends the standard error with code and metadata properties. The library also contains a couple of utility functions & decorators to define default values to minimize repeated code and simplify writing custom errors.
You can install the package from NPM registry
# pnpm
pnpm add @xkcm/better-errors
# yarn
yarn add @xkcm/better-errors
# npm
npm add @xkcm/better-errors
See full documentation at xkcm.github.io/better-errors