Class FlowException

All Implemented Interfaces:
Serializable

public class FlowException extends RuntimeException
Thrown when a step in an EasyAI.flow() pipeline fails, naming exactly which step it was.

When a FlowStep throws, Flow.run(Object) stops the pipeline and wraps the original exception in a FlowException whose stepName() tells you where the line jammed. The original failure is preserved as the cause, so you lose nothing.

Familiar analogy: a fault ticket on an assembly line that names the station that jammed ("checkStock") and staples the machine's own error report to the back. You do not have to guess which of six stations stopped the line — the ticket says so.

Place in the flow

   Flow.run(input)
        → FlowStep.run(ctx) throws  → wrapped as new FlowException(stepName, cause)
        → emitter.error(...)         → re-thrown to the caller of Flow.run
 
See Also:
  • Constructor Details

    • FlowException

      public FlowException(String stepName, Throwable cause)
      Creates a flow failure tagged with the failing step's name.
      Parameters:
      stepName - the name of the step that threw (as registered with FlowBuilder.step)
      cause - the original exception the step threw
  • Method Details

    • stepName

      public String stepName()
      Returns the name of the step that failed.

      Lets a caller branch or report on which step broke without parsing the message — e.g. catch (FlowException e) { if ("pay".equals(e.stepName())) ... }.

      Returns:
      the failing step's name