@doesrobbiedream/nest-catcher
v0.2.0
Published
> Nest Catcher is a nest library to provide a homogeneous exception handling across your entire Nest API.
Downloads
3
Readme
Nest Catcher
Nest Catcher is a nest library to provide a homogeneous exception handling across your entire Nest API.
It provides support for both monolithic APIs and distributed architecture.
On distributed architectures with a logical gateway, the first caught error that handles the exception will prevail and the following layers won't transform the response.
This allows to have multiple representations of the same error code that respect the domain into where it was fired.
For example:
On an Authentication Service a 409 error (Conflict) could represent a duplicated user trying to be injected.
On an Inventory Service could mean a given product is not accessible by the requesting user.
If a frontal layer has to know both meanings to handle the exception properly, the service isolation will be broken, although, we don't want each service to have their own exception handler, as the gateway has that responsability.
For that, Nest Catcher, provides an intuitive API to each service to handler their own exceptions and letting the gateway build the response as necessary with the data provided.