public class ResponseStatusException extends NestedRuntimeException
Constructor and Description |
---|
ResponseStatusException(HttpStatus status)
Constructor with a response status.
|
ResponseStatusException(HttpStatus status,
String reason)
Constructor with a response status and a reason to add to the exception
message as explanation.
|
ResponseStatusException(HttpStatus status,
String reason,
Throwable cause)
Constructor with a response status and a reason to add to the exception
message as explanation, as well as a nested exception.
|
Modifier and Type | Method and Description |
---|---|
Map<String,String> |
getHeaders()
Return response headers associated with the exception, possibly required
for the given status code (e.g.
|
String |
getMessage()
Return the detail message, including the message from the nested exception
if there is one.
|
String |
getReason()
The reason explaining the exception (potentially
null or empty). |
HttpStatus |
getStatus()
Return the HTTP status associated with this exception.
|
contains, getMostSpecificCause, getRootCause
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public ResponseStatusException(HttpStatus status)
status
- the HTTP status (required)public ResponseStatusException(HttpStatus status, @Nullable String reason)
status
- the HTTP status (required)reason
- the associated reason (optional)public ResponseStatusException(HttpStatus status, @Nullable String reason, @Nullable Throwable cause)
status
- the HTTP status (required)reason
- the associated reason (optional)cause
- a nested exception (optional)public HttpStatus getStatus()
public Map<String,String> getHeaders()
@Nullable public String getReason()
null
or empty).public String getMessage()
NestedRuntimeException
getMessage
in class NestedRuntimeException