All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ee.telekom.workflow.util.ExceptionUtil Maven / Gradle / Ivy

Go to download

Telekom-workflow-engine core provides the runtime environment for workflow execution together with all the supporting services (clustering, persistence, error handling etc).

There is a newer version: 1.6.3
Show newest version
package ee.telekom.workflow.util;

import org.apache.commons.lang3.exception.ExceptionUtils;

import ee.telekom.workflow.graph.WorkflowException;

public class ExceptionUtil{

    public static String getErrorText( Exception exception ){
        Throwable cause = getWorkflowCause( exception );
        return cause == null ? exception.getMessage() : cause.getMessage();
    }

    public static String getErrorDetails( Exception exception ){
        return ExceptionUtils.getStackTrace( exception );
    }

    /**
     * Finds the first cause in the exception hierarchy that is not an instance
     * of {@link WorkflowException}.
     */
    private static Throwable getWorkflowCause( Exception exception ){
        Throwable e = exception;
        while( e instanceof WorkflowException ){
            e = e.getCause();
        }
        return e;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy