Creates a new instance of application exception and assigns its values.
(optional) a standard error category. Default: Unknown
(optional) a unique transaction id to trace execution through call chain.
(optional) a unique error code. Default: "UNKNOWN"
(optional) a human-readable description of the error.
Standard error category
Original error wrapped by this exception
A unique error code
A unique transaction id to trace execution throug call chain
A map with additional details that can be used to restore error description in other languages
A human-readable error description (usually written in English)
Stack trace of the exception
HTTP status code associated with this error type
Gets original error wrapped by this exception as a string message.
an original error message.
Gets a stack trace where this exception occured.
a stack trace as a string.
Sets original error wrapped by this exception as a string message.
an original error message.
Sets a stack trace where this exception occured.
a stack trace as a string
Sets a original error wrapped by this exception
This method returns reference to this exception to implement Builder pattern to chain additional calls.
original error object
this exception object
Sets a unique error code.
This method returns reference to this exception to implement Builder pattern to chain additional calls.
a unique error code
this exception object
Sets a correlation id which can be used to trace this error through a call chain.
This method returns reference to this exception to implement Builder pattern to chain additional calls.
a unique transaction id to trace error through call chain
this exception object
Sets a parameter for additional error details. This details can be used to restore error description in other languages.
This method returns reference to this exception to implement Builder pattern to chain additional calls.
a details parameter name
a details parameter name
this exception object
Sets a stack trace for this error.
This method returns reference to this exception to implement Builder pattern to chain additional calls.
a stack trace where this error occured
this exception object
Sets a HTTP status code which shall be returned by REST calls.
This method returns reference to this exception to implement Builder pattern to chain additional calls.
an HTTP error code.
this exception object
Wraps another exception into an application exception object.
If original exception is of ApplicationException type it is returned without changes. Otherwise a new ApplicationException is created and original error is set as its cause.
an original error object
an original or newly created ApplicationException
Unwraps original exception through wrapped exception objects.
Many frameworks like Seneca or restify wrap original exception. That may result in propagating less specific errors and can hide causes of the errors.
an error object
an original error object
Wraps another exception into specified application exception object.
If original exception is of ApplicationException type it is returned without changes. Otherwise the original error is set as a cause to specified ApplicationException object.
an ApplicationException object to wrap the cause
an original error object
an original or newly created ApplicationException
Generated using TypeDoc
Defines a base class to defive various application exceptions.
Most languages have own definition of base exception (error) types. However, this class is implemented symmetrically in all languages supported by PipServices toolkit. It allows to create portable implementations and support proper error propagation in microservices calls.
Error propagation means that when microservice implemented in one language calls microservice(s) implemented in a different language(s), errors are returned throught the entire call chain and restored in their original (or close) type.
Since number of potential exception types is endless, PipServices toolkit supports only 12 standard categories of exceptions defined in ErrorCategory. This ApplicationException class acts as a basis for all other 12 standard exception types.
Most exceptions have just free-form message that describes occured error. That may not be sufficient to create meaninful error descriptions. The ApplicationException class proposes an extended error definition that has more standard fields:
ApplicationException class is not serializable. To pass errors through the wire it is converted into ErrorDescription object and restored on receiving end into identical exception type.
ErrorCategory
ErrorDescription