public class AppianException
extends java.lang.Exception
AppianException
is the base class of all application-level
exceptions thrown in the product. Application-level
exceptions are intended to be caught and handled locally by one of the
callers that is capable of taking the appropriate action (such as retrying,
performing alternative operations, notifying the user, showing a local
message on the user interface, etc.) AppianException takes care of properly
formatting and internationalizing the exception messages by associating the
exception with an error code. Subclasses should override the getErrorCode and
getErrorCodeArguments methods to map the appropriate message to the
exception.AppianRuntimeException
,
Serialized FormConstructor and Description |
---|
AppianException()
Deprecated.
|
AppianException(ErrorCode errorCode,
java.lang.Object... errorCodeArgs) |
AppianException(ErrorCode errorCode,
java.lang.Throwable cause) |
AppianException(ErrorCode errorCode,
java.lang.Throwable cause,
java.lang.Object... errorCodeArgs) |
AppianException(java.lang.String message)
Deprecated.
this constructor will be removed in future releases, as all
exception messages must be associated via an error code.
|
AppianException(java.lang.String message,
java.lang.Throwable cause)
Deprecated.
this constructor will be removed in future releases, as all
exception messages must be associated via an error code.
|
AppianException(java.lang.Throwable cause)
Constructs a new
AppianException as a wrapper around the
Throwable passed in with a detail message of
(cause==null ? |
Modifier and Type | Method and Description |
---|---|
ErrorCode |
getErrorCode()
Gets the error code associated with this exception.
|
protected java.lang.Object[] |
getErrorCodeArguments()
Gets the arguments that must be used to render this exception's message
representation.
|
protected java.lang.Object[] |
getErrorCodeArguments(java.util.Locale locale)
Gets the arguments that must be used to render this exception's message and title
representation.
|
java.lang.String[] |
getErrorCodeArgumentsAsStringArray(java.util.Locale locale)
Returns the arguments (converted to Strings) of the error code tied to this exception.
|
java.lang.String |
getLocalizedMessage()
The default implementation is equivalent to calling
getLocalizedMessage(Locale) with Locale.US
as argument. |
java.lang.String |
getLocalizedMessage(java.util.Locale locale)
Returns this exception's message representation.
|
java.lang.String |
getLocalizedMessageWithErrorCode(java.util.Locale locale)
Returns this exception's default message representation with error code
information.
|
java.lang.String |
getLocalizedTitle(java.util.Locale locale)
Returns this exception's title representation.
|
java.lang.String |
getMessage()
The default implementation is equivalent to calling
getLocalizedMessage() |
java.lang.String |
toString()
Returns a detailed exception's message representation.
|
public AppianException(ErrorCode errorCode, java.lang.Object... errorCodeArgs)
public AppianException(ErrorCode errorCode, java.lang.Throwable cause)
public AppianException(ErrorCode errorCode, java.lang.Throwable cause, java.lang.Object... errorCodeArgs)
@Deprecated public AppianException()
AppianException
with an empty string as its detail message.@Deprecated public AppianException(java.lang.String message)
public AppianException(java.lang.Throwable cause)
AppianException
as a wrapper around the
Throwable
passed in with a detail message of
(cause==null ? "" : cause.toString())
.cause
- the cause, or the Throwable
that caused this
AppianException
to get thrown@Deprecated public AppianException(java.lang.String message, java.lang.Throwable cause)
public ErrorCode getErrorCode()
ErrorCode.GENERIC_ERROR
protected java.lang.Object[] getErrorCodeArguments()
getErrorCodeArguments(Locale)
hasn't been
overwritten.ErrorCode.GENERIC_ERROR
public final java.lang.String[] getErrorCodeArgumentsAsStringArray(java.util.Locale locale)
locale
- The locale to use for retrieving the arguments.protected java.lang.Object[] getErrorCodeArguments(java.util.Locale locale)
getErrorCodeArguments()
.locale
- arguments' localepublic java.lang.String getMessage()
getLocalizedMessage()
getMessage
in class java.lang.Throwable
public java.lang.String getLocalizedMessage()
getLocalizedMessage(Locale)
with Locale.US
as argument.getLocalizedMessage
in class java.lang.Throwable
public java.lang.String getLocalizedMessage(java.util.Locale locale)
getErrorCode()
.locale
- message's localetoString()
public java.lang.String getLocalizedTitle(java.util.Locale locale)
getErrorCode()
.locale
- title's localetoString()
public java.lang.String getLocalizedMessageWithErrorCode(java.util.Locale locale)
getLocalizedMessage(Locale)
does not include any error code
information, as the representation could vary in different ways across the
application, this method provides a utility for a representation with error
code. If the error code is null
or
ErrorCode.GENERIC_ERROR
, no error code information is included.
Be sure while using this method as the requirements could vary, in
which case use getLocalizedMessage(Locale)
in conjunction
with getErrorCode()
.locale
- message's localegetLocalizedMessage(Locale)
,
toString()
public java.lang.String toString()
getMessage()
and the error code
associated with this exception. If the error code is
ErrorCode.GENERIC_ERROR
, no error code information is included.toString
in class java.lang.Throwable
Copyright © 2003-2024 Appian Corporation. All Rights Reserved.