@ProviderType
public class APIError
extends java.lang.Object
javax.ws.rs.WebApplicationException
and its descendants are converted to
APIError
. All other exceptions are converted to a 500
error
with a standard message.Constructor and Description |
---|
APIError(java.lang.Exception exception,
java.lang.String title,
java.lang.String type,
int statusCode) |
APIError(java.lang.Exception exception,
java.lang.String title,
java.lang.String description,
java.lang.String type,
int statusCode) |
Modifier and Type | Method and Description |
---|---|
java.util.Optional<java.lang.String> |
getDescription()
Returns the API error's description, if present;
Optional#empty()
otherwise. |
java.lang.Exception |
getException()
Returns the API error's original exception.
|
java.lang.String |
getMessage()
Returns the API error's message.
|
int |
getStatusCode()
Returns the API error's HTTP status code.
|
java.lang.String |
getTitle()
Returns the API error's title.
|
java.lang.String |
getType()
Returns the API error's type.
|
public APIError(java.lang.Exception exception, java.lang.String title, java.lang.String type, int statusCode)
public APIError(java.lang.Exception exception, java.lang.String title, java.lang.String description, java.lang.String type, int statusCode)
public java.util.Optional<java.lang.String> getDescription()
Optional#empty()
otherwise.Optional#empty()
otherwisepublic java.lang.Exception getException()
public java.lang.String getMessage()
public int getStatusCode()
public java.lang.String getTitle()
public java.lang.String getType()
NotAuthorizedException
, an implementation of this method could return
"not-authorized"
.