Package com.appiancorp.exceptions
Class AppianErrorBuilder
java.lang.Object
com.appiancorp.exceptions.AppianErrorBuilder
Builds localized
AppianError objects using Appian error codes.-
Constructor Summary
ConstructorsConstructorDescriptionAppianErrorBuilder(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 createAppianErrors from exceptions.static final AppianErrorfromThrowable(Locale targetLocale, Throwable t) Creates anAppianErrorfrom the given exception, by applying the function generated byfromThrowable(Locale).static final AppianErrorfromThrowable(Locale targetLocale, Throwable t, ErrorCode defaultError) Creates anAppianErrorfrom 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 anAppianErrorfrom 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 (AppianExceptionorAppianRuntimeException) -
fromThrowable
Creates anAppianErrorfrom 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 createAppianErrors from exceptions. This function will traverse the cause exceptions of any given exception. For non-Appian exceptions, the error codeErrorCode.GENERIC_RUNTIME_ERRORis used, and the exception class name and message are placed in thedetailsof the error bean. For Appian exceptions (anyAppianExceptionorAppianRuntimeException), the localized message is retrieved using the given locale.
-