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