Package com.appiancorp.exceptions
Class AppianErrorBuilder
java.lang.Object
com.appiancorp.exceptions.AppianErrorBuilder
Builds localized
AppianError
objects using Appian error codes.-
Constructor Summary
ConstructorDescriptionAppianErrorBuilder
(AppianErrorCodeFormatter formatter, ErrorCode code, Object... args) AppianErrorBuilder
(ErrorCode code, String message) AppianErrorBuilder
(ErrorCode code, String message, String title) AppianErrorBuilder
(Locale targetLocale, ErrorCode code, Object... args) -
Method Summary
Modifier and TypeMethodDescriptionbuild()
static final com.google.common.base.Function<Throwable,
AppianError> fromThrowable
(Locale targetLocale) Returns a function to createAppianError
s from exceptions.static final AppianError
fromThrowable
(Locale targetLocale, Throwable t) Creates anAppianError
from the given exception, by applying the function generated byfromThrowable(Locale)
.static final AppianError
fromThrowable
(Locale targetLocale, Throwable t, ErrorCode defaultError) Creates anAppianError
from the given exception, by applying the function generated byfromThrowable(Locale)
.setCause
(AppianErrorBuilder causeBuilder) setDetails
(String details)
-
Constructor Details
-
AppianErrorBuilder
-
AppianErrorBuilder
-
AppianErrorBuilder
-
AppianErrorBuilder
-
-
Method Details
-
setTitle
-
setDetails
-
setCause
-
build
-
fromThrowable
public static final AppianError fromThrowable(Locale targetLocale, Throwable t, ErrorCode defaultError) Creates anAppianError
from the given exception, by applying the function generated byfromThrowable(Locale)
. Uses the supplied default error code for any exceptions that are do not supply their own codes (AppianException
orAppianRuntimeException
) -
fromThrowable
Creates anAppianError
from the given exception, by applying the function generated byfromThrowable(Locale)
. -
fromThrowable
public static final com.google.common.base.Function<Throwable,AppianError> fromThrowable(Locale targetLocale) Returns a function to createAppianError
s from exceptions. This function will traverse the cause exceptions of any given exception. For non-Appian exceptions, the error codeErrorCode.GENERIC_RUNTIME_ERROR
is used, and the exception class name and message are placed in thedetails
of the error bean. For Appian exceptions (anyAppianException
orAppianRuntimeException
), the localized message is retrieved using the given locale.
-