nestjs-addons / nestjs-addons

Org Assets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RFC: Create Error Handling Addon

itayod opened this issue · comments

We need to create an error-handling API for handling/raising exceptions.

The error handler will be used by our internal services for cases we need to raise an exception (e.g when a record could not be found), and also could be used by the user.

The mechanism will must be open for modification, so the user could provide his own exceptions.

possible solution:

  • Create an ERROR_HANDLER token that implements a predetermined interface.
  • The Interface will have a handle method that gets an ErrorCode (and maybe few other attributes).
  • Provide a default generic error handler.