Spring's Internal Exceptions
Selected set of most common Spring exceptions handled by Problem4J Spring. For a complete listing, including what unknown exceptions resolve into, see Exception Resolution Reference.
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
ErrorResponseException is Spring's counterpart of ProblemException. It carries an HTTP status and a
ProblemDetail, which is copied into the response whole - type, title, detail, instance and all custom
properties.
{
"type" : "https://example.org/problem-type",
"title" : "Some Error",
"status" : 400,
"detail" : "Explanation of the error",
"instance" : "https://example.org/instances/123"
}
Its subclass ResponseStatusException keeps only the status, as its reason often contains internal details. See
Exception Resolution Reference.
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"}