Package com.orchestranetworks.rest
Class LocalizedException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- javax.ws.rs.WebApplicationException
-
- com.orchestranetworks.rest.LocalizedException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AuthenticationException
,UnprocessableEntityException
public class LocalizedException extends WebApplicationException
Class that can be extended by exceptions that return a localized error message.If thrown by REST services and not caught, they will be automatically transformed into an appropriate JAX-RS HTTP response and may be displayed to the end user.
- Since:
- 5.9.0
- See Also:
- Exception handling
-
-
Constructor Summary
Constructors Constructor Description LocalizedException(int aStatus, UserMessage aUserMessage)
LocalizedException(int aStatus, UserMessage aUserMessage, Integer anErrorCode)
LocalizedException(int aStatus, UserMessage aUserMessage, Integer anErrorCode, Throwable aCause)
Constructs a new instance with the provided data.LocalizedException(int aStatus, UserMessage aUserMessage, Throwable aCause)
Constructs a new instance with the provided data, without functional error code.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Integer
getErrorCode()
Returns the functional error code provided by the REST service.int
getStatus()
Returns the HTTP status code associated with the response.UserMessage
getUserMessage()
Returns the user message that may be displayed to the end user as an error message.-
Methods inherited from class javax.ws.rs.WebApplicationException
getResponse
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
LocalizedException
public LocalizedException(int aStatus, UserMessage aUserMessage)
-
LocalizedException
public LocalizedException(int aStatus, UserMessage aUserMessage, Throwable aCause)
Constructs a new instance with the provided data, without functional error code.- Since:
- 6.0.0
- See Also:
LocalizedException(int, UserMessage, Integer, Throwable)
-
LocalizedException
public LocalizedException(int aStatus, UserMessage aUserMessage, Integer anErrorCode)
-
LocalizedException
public LocalizedException(int aStatus, UserMessage aUserMessage, Integer anErrorCode, Throwable aCause)
Constructs a new instance with the provided data.- Parameters:
aStatus
- the HTTP status code that will be returned to the client.aUserMessage
- the localized message that may be displayed to the end user.anErrorCode
- the functional error code.aCause
- The underlying cause of this thrown exception
-
-
Method Detail
-
getErrorCode
public final Integer getErrorCode()
Returns the functional error code provided by the REST service.It may be
null
.
-
getStatus
public final int getStatus()
Returns the HTTP status code associated with the response.
-
getUserMessage
public final UserMessage getUserMessage()
Returns the user message that may be displayed to the end user as an error message.It may be
null
.
-
-