m8ty-exception - m8ty Exceptions
This module contains all exceptions of m8ty.
There are some specific exceptions, such as InternalError or ObjectNotFound, but also a generic exception M8tyExecption.
As the exceptions contain the final HTTP status, a code and the message, it is not absolutely necessary to introduce further exceptions unless they need to be handled specifically.
Your own exceptions should always be derived from the AbstractM8tyException and are already mapped by storing this class in the GlobalExceptionHandler.
The exceptions can be used as follows:
throw M8tyExecption(
message = "Please do something else!",
code = "ERR_0x0001",
httpStatus = FORBIDDEN
)Content copied to clipboard