By default, the library has an ExceptionHandler that will automatically create a status code and a response body based on the exception thrown.
Also other exception (in addition to those in this file) from kotlin-utils are considered as status-override:
ExternalServiceHttpException → 502 Bad GatewayInsufficientPermissionsException → 403 ForbiddenMalformedHeaderException → 400 Bad RequestMalformedInputException → 400 Bad RequestMalformedParameterException → 400 Bad RequestRequiredHeaderException → 400 Bad RequestRequiredFieldException → 400 Bad RequestRequiredParameterException → 400 Bad RequestResourceAlreadyExistsException → 409 ConflictResourceConflictException → 409 ConflictResourceDeletedException → 410 GoneResourceLockedException → 423 LockedResourceNotAcceptableException → 422 Unprocessable EntityResourceNotFoundException → 404 Not FoundYou can choose your favourite body type:
RFC (default)
{
"title": "Not Found",
"status": 404,
"exception": "ResourceNotFoundException"
"detail": "Resource `e6b0dbd8-9993-470f-9946-21f1a6b37811` not found",
"instance": "/projects/3"
"internalErrorCode": "ERR:1:2:34"
} // nulls not present
simple
{
"title": "Not Found: ResourceNotFoundException",
"description": "Resource `e6b0dbd8-9993-470f-9946-21f1a6b37811` not found",
"internalErrorCode": "ERR:1:2:34" // property not present if null or blank
}