ExceptionManager is an utility class who can insert or erase custom error
class with its conversion method to a regular nest.HttpException
instance.
If you define an API function through TypedRoute or
EncryptedRoute instead of the basic router decorator functions like
nest.Get or nest.Post and the API function throws a custom
error whose class has been inserted in this
ExceptionManager, the error would be automatically converted to the regular
nest.HttpException instance by the ExceptionManager.Closure
function.
Therefore, with this ExceptionManager and TypedRoute or
EncryptedRoute, you can manage your custom error classes much
systematically. You can avoid 500 internal server error or hard coding
implementation about the custom error classes.
Below error class is configured in this ExceptionManager by default.
contracts/common.md#principled-implementation Converters are kept as an ordered list of class and closure, and an error is converted by the first class it is an instance of; the insertion keeps every subclass before its superclasses so the most specific converter wins, and HttpError from the fetcher is registered by default.
Evidence
contracts/common.md#clear-and-simple-design One namespace with the two collections and four operations; the listener set and the tuple list are the only state.
Evidence
contracts/common.md#prohibited-implementation-shortcuts The registration is public and explicit; no error class is special-cased except the default HttpError conversion.
Evidence
contracts/common.md#meaningful-documentation The comment documents the converter and listener concepts with an example.
Evidence Exclude
contracts/portability.md#os-neutral-implementation Converter ordering and listener registration operate on JavaScript class and function identity, not native path or process identity.
Exception manager for HTTP server.
ExceptionManageris an utility class who can insert or erase custom error class with its conversion method to a regular nest.HttpException instance.If you define an API function through TypedRoute or EncryptedRoute instead of the basic router decorator functions like nest.Get or nest.Post and the API function throws a custom error whose class has been inserted in this
ExceptionManager, the error would be automatically converted to the regular nest.HttpException instance by the ExceptionManager.Closure function.Therefore, with this
ExceptionManagerand TypedRoute or EncryptedRoute, you can manage your custom error classes much systematically. You can avoid 500 internal server error or hard coding implementation about the custom error classes.Below error class is configured in this
ExceptionManagerby default.@nestia/fetcher.HttpErrorAuthor
Jeongho Nam - https://github.com/samchon
Evidence
contracts/common.md#principled-implementation Converters are kept as an ordered list of class and closure, and an error is converted by the first class it is an instance of; the insertion keeps every subclass before its superclasses so the most specific converter wins, and
HttpErrorfrom the fetcher is registered by default.Evidence
contracts/common.md#clear-and-simple-design One namespace with the two collections and four operations; the listener set and the tuple list are the only state.
Evidence
contracts/common.md#prohibited-implementation-shortcuts The registration is public and explicit; no error class is special-cased except the default
HttpErrorconversion.Evidence
contracts/common.md#meaningful-documentation The comment documents the converter and listener concepts with an example.
Evidence Exclude
contracts/portability.md#os-neutral-implementation Converter ordering and listener registration operate on JavaScript class and function identity, not native path or process identity.