@aequum/exceptions
TypeScript icon, indicating that this package has built-in type declarations

0.27.15 • Public • Published

aequum common exceptions collection

This package provides a set of rich, descriptive and detailed exceptions interfaces, classes and types to have an standard way to handle show errors and providing the right information to the user or developer when an error occurs in the application.

Design

Each exception class must have:

  • A text code for error, we use ERR_ prefix and uppercase snake case.
  • An HTTP status code for the error is available but isn't mandatory by default it uses a 500 error code.
  • A human readable message that describes the error.
  • An input object or struct to show the input that caused the error, on some complex cases it have an structured object with more details, as in case of ValidationException.
  • Also one of the base constructor arguments are the cause of the error if it derives from another exception, this is useful to trace the error back to its origin.

Classes

Base:

Authorization:

Data:

Validation:

  • ValidationException: Validation exception, for input objects, this exception have an structured output for input property, representing the input property validated and it's corresponding error messages.

Interfaces

  • ValidationableException: Interface with asValidationException method to convert an error/exception/validation object into a validation exception.

Readme

Keywords

none

Package Sidebar

Install

npm i @aequum/exceptions

Weekly Downloads

35

Version

0.27.15

License

Apache-2.0

Unpacked Size

25.6 kB

Total Files

26

Last publish

Collaborators

  • fbuccioni