Spring's Internal Exceptions
Selected set of most common Spring exceptions handled by Problem4J Spring.
Occurrences of TypeMismatchException
Triggered for example when trying to pass String value into @RequestParam("param") Integer param.
{
"status" : 400,
"title" : "Bad Request",
"detail" : "Type mismatch",
"property" : "age",
"kind" : "integer"
}
Occurrences of ErrorResponseException
Similar to ProblemException, but comes from Spring and relies on mutable ProblemDetails object.
Explicitly thrown ErrorResponseException (or subclasses like ResponseStatusException). Each of these exceptions
carry HTTP status within it as well as details to be used in application/problem+json response.
Example:
{
"type" : "https://example.org/problem-type",
"title" : "Some Error",
"status" : 400,
"detail" : "Explanation of the error",
"instance" : "https://example.org/instances/123"
}
General HTTP Stuff
- If trying to call
POSTfor and endpoint with onlyGET(or any other similar situation), service will write following response.{
"status" : 405,
"title" : "Method Not Allowed"
} - If calling REST API with invalid
Acceptheader, service will write following response.{
"status" : 406,
"title" : "Not Acceptable"
} - If calling REST API with invalid
Content-Typeheader, service will write following response.{
"status" : 415,
"title" : "Unsupported Media Type"
} - If passing request body that has invalid JSON syntax, service will write following response.
{
"status" : 400,
"title" : "Bad Request"
} - If passing request that's too large by configuration, service will write following response. Note that reason phrase
for
413was changed intoContent Too Largein [RFC 9110 §15.5.14][rfc9110-15.5.4].{
"status" : 413,
"title" : "Content Too Large"
}