Package io.dapr.durabletask
Class FailureDetails
java.lang.Object
io.dapr.durabletask.FailureDetails
Class 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
Modifier and TypeMethodDescriptionGets a summary description of the error that caused this failure.Gets the exception class name if the failure was caused by an unhandled exception.static StringGets the full stack trace of the specified exception.Gets the stack trace of the exception that caused this failure, ornullif the failure was caused by a non-exception error.booleanisCausedBy(Class<? extends Exception> exceptionClass) Returnstrueif the task failure was provided by the specified exception type, otherwisefalse.booleanReturnstrueif the failure doesn't permit retries, otherwisefalse.
-
Method Details
-
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
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
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
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
-
getFullStackTrace
Gets the full stack trace of the specified exception.- Parameters:
e- the exception- Returns:
- the full stack trace of the exception
-