Package org.forgerock.openam.rest.query
Class QueryException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.forgerock.openam.rest.query.QueryException
-
- All Implemented Interfaces:
L10NMessage,Serializable
public class QueryException extends RuntimeException implements L10NMessage
General query exception that allows for localised messages.- Since:
- 13.0.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classQueryException.QueryErrorCodeError messages are stored in the queryError.properties file to facilitate translation.
-
Constructor Summary
Constructors Constructor Description QueryException(QueryException.QueryErrorCode errorCode, String... arguments)Construct aQueryException.QueryException(QueryException.QueryErrorCode errorCode, Throwable cause, String... arguments)Construct aQueryException.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetErrorCode()Use this method to chain this exception with another to get localized error messge use getL10NMessage methodStringgetL10NMessage(Locale locale)Use this method to get localized error message directly.StringgetLocalizedMessage()StringgetMessage()Use this method to get error message in default ENGLISH locale.Object[]getMessageArgs()Use this method to chain this exception with another to get localized error messge use getL10NMessage methodStringgetResourceBundleName()Use this method to chain this exception with another to get localized error messge use getL10NMessage method-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
QueryException
public QueryException(QueryException.QueryErrorCode errorCode, Throwable cause, String... arguments)
Construct aQueryException.- Parameters:
errorCode- The error code to use for the exception message.cause- TheThrowablethat caused the error.arguments- Arguments used in the message associated with the error code.- Throws:
NullPointerException- if errorCode is null
-
QueryException
public QueryException(QueryException.QueryErrorCode errorCode, String... arguments)
Construct aQueryException.- Parameters:
errorCode- The error code to use for the exception message.arguments- Arguments used in the message associated with the error code.
-
-
Method Detail
-
getL10NMessage
public String getL10NMessage(Locale locale)
Description copied from interface:L10NMessageUse this method to get localized error message directly.- Specified by:
getL10NMessagein interfaceL10NMessage- Parameters:
locale- Locale of the error message.- Returns:
- localized error message.
-
getResourceBundleName
public String getResourceBundleName()
Description copied from interface:L10NMessageUse this method to chain this exception with another to get localized error messge use getL10NMessage method- Specified by:
getResourceBundleNamein interfaceL10NMessage- Returns:
- ResourceBundle Name associated with this error message.
-
getErrorCode
public String getErrorCode()
Description copied from interface:L10NMessageUse this method to chain this exception with another to get localized error messge use getL10NMessage method- Specified by:
getErrorCodein interfaceL10NMessage- Returns:
- Error code associated with this error message.
-
getMessageArgs
public Object[] getMessageArgs()
Description copied from interface:L10NMessageUse this method to chain this exception with another to get localized error messge use getL10NMessage method- Specified by:
getMessageArgsin interfaceL10NMessage- Returns:
- arguments for formatting this error message. You need to use MessageFormat class to format the message It can be null.
-
getMessage
public String getMessage()
Description copied from interface:L10NMessageUse this method to get error message in default ENGLISH locale.- Specified by:
getMessagein interfaceL10NMessage- Overrides:
getMessagein classThrowable- Returns:
- gets error message
-
getLocalizedMessage
public String getLocalizedMessage()
- Overrides:
getLocalizedMessagein classThrowable
-
-