Package com.microsoft.durabletask
Class FailureDetails
- java.lang.Object
-
- com.microsoft.durabletask.FailureDetails
-
public final class FailureDetails extends java.lang.ObjectClass that represents the details of a task failure.In most cases, failures are caused by unhandled exceptions in activity or orchestrator code, in which case instances of this class will expose the details of the exception. However, it's also possible that other types of errors could result in task failures, in which case there may not be any exception-specific information.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetErrorMessage()Gets a summary description of the error that caused this failure.java.lang.StringgetErrorType()Gets the exception class name if the failure was caused by an unhandled exception.java.lang.StringgetStackTrace()Gets the stack trace of the exception that caused this failure, ornullif the failure was caused by a non-exception error.booleanisCausedBy(java.lang.Class<? extends java.lang.Exception> exceptionClass)Returnstrueif the task failure was provided by the specified exception type, otherwisefalse.booleanisNonRetriable()Returnstrueif the failure doesn't permit retries, otherwisefalse.
-
-
-
Method Detail
-
getErrorType
@Nonnull public java.lang.String getErrorType()
Gets the exception class name if the failure was caused by an unhandled exception. Otherwise, gets a symbolic name that describes the general type of error that was encountered.- Returns:
- the error type as a
Stringvalue
-
getErrorMessage
@Nonnull public java.lang.String getErrorMessage()
Gets a summary description of the error that caused this failure. If the failure was caused by an exception, the exception message is returned.- Returns:
- a summary description of the error
-
getStackTrace
@Nullable public java.lang.String getStackTrace()
Gets the stack trace of the exception that caused this failure, ornullif the failure was caused by a non-exception error.- Returns:
- the stack trace of the failure exception or
nullif the failure was not caused by an exception
-
isNonRetriable
public boolean isNonRetriable()
Returnstrueif the failure doesn't permit retries, otherwisefalse.- Returns:
trueif the failure doesn't permit retries, otherwisefalse.
-
isCausedBy
public boolean isCausedBy(java.lang.Class<? extends java.lang.Exception> exceptionClass)
Returnstrueif the task failure was provided by the specified exception type, otherwisefalse.This method allows checking if a task failed due to a specific exception type by attempting to load the class specified in
getErrorType(). If the exception class cannot be loaded for any reason, this method will returnfalse. Base types are supported by this method, as shown in the following example:boolean isRuntimeException = failureDetails.isCausedBy(RuntimeException.class);- Parameters:
exceptionClass- the class representing the exception type to test- Returns:
trueif the task failure was provided by the specified exception type, otherwisefalse
-
-