case classErrorRef(errorId: UUID, timestamp: Long, message: Option[String]) extends Product with Serializable
An unexpected exception wrapper that is aimed for being sent to a client as a result of a failed operation.
ErrorRef holds a unique identifier (UUID) with which the exception is logged to the server logs.
It may optionally also take an error message dedicated for a client, that may be different from the one of the original exception.
This way the error message that the client receives can be matched with the corresponding server-side error later
for the ease of troubleshooting.
Usage example:
When an unexpected error occurs during processing a client request, instead of propagating the exception
to the client verbatim, create an ErrorRef instance (e.g. via ErrorRef.apply()
and return it as a response body along with an appropriate response status code (e.g. 500).
Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
An unexpected exception wrapper that is aimed for being sent to a client as a result of a failed operation.
ErrorRef
holds a unique identifier (UUID) with which the exception is logged to the server logs. It may optionally also take an error message dedicated for a client, that may be different from the one of the original exception.This way the error message that the client receives can be matched with the corresponding server-side error later for the ease of troubleshooting.
Usage example:
When an unexpected error occurs during processing a client request, instead of propagating the exception to the client verbatim, create an
ErrorRef
instance (e.g. viaErrorRef.apply()
and return it as a response body along with an appropriate response status code (e.g. 500).