FailureDetails Class
- java.
lang. Object - com.
microsoft. durabletask. FailureDetails
- com.
public final class 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 Type | Method and Description |
|---|---|
| java.lang.String |
getErrorMessage()
Gets a summary description of the error that caused this failure. |
| java.lang.String |
getErrorType()
Gets the exception class name if the failure was caused by an unhandled exception. |
| java.lang.String |
getStackTrace()
Gets the stack trace of the exception that caused this failure, or |
| boolean |
isCausedBy(Class<? extends Exception> exceptionClass)
Returns |
| boolean |
isNonRetriable()
Returns |
Methods inherited from java.lang.Object
Method Details
getErrorMessage
public 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:
getErrorType
public 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:
String valuegetStackTrace
public String getStackTrace()
Gets the stack trace of the exception that caused this failure, or null if the failure was caused by a non-exception error.
Returns:
null if the failure was not caused by an exceptionisCausedBy
public boolean isCausedBy(Class exceptionClass)
Returns true if the task failure was provided by the specified exception type, otherwise false.
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 return false. Base types are supported by this method, as shown in the following example:
boolean isRuntimeException = failureDetails.isCausedBy(RuntimeException.class);
Parameters:
Returns:
true if the task failure was provided by the specified exception type, otherwise falseisNonRetriable
public boolean isNonRetriable()
Returns true if the failure doesn't permit retries, otherwise false.
Returns:
true if the failure doesn't permit retries, otherwise false.