Class FailureDetails


  • public final class FailureDetails
    extends java.lang.Object
    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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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 null if the failure was caused by a non-exception error.
      boolean isCausedBy​(java.lang.Class<? extends java.lang.Exception> exceptionClass)
      Returns true if the task failure was provided by the specified exception type, otherwise false.
      boolean isNonRetriable()
      Returns true if the failure doesn't permit retries, otherwise false.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 String value
      • 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, or null if the failure was caused by a non-exception error.
        Returns:
        the stack trace of the failure exception or null if the failure was not caused by an exception
      • isNonRetriable

        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.
      • isCausedBy

        public boolean isCausedBy​(java.lang.Class<? extends java.lang.Exception> 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:
        exceptionClass - the class representing the exception type to test
        Returns:
        true if the task failure was provided by the specified exception type, otherwise false