Exception: BetterService::Errors::Workflowable::Runtime::StepExecutionError

Inherits:
WorkflowRuntimeError show all
Defined in:
lib/better_service/errors/workflowable/runtime/step_execution_error.rb

Overview

Raised when a workflow step execution fails

This error is raised when a step in the workflow fails and the step is not optional. The error includes context about which step failed and what steps were executed.

Examples:

Step execution failure

class MyWorkflow < BetterService::Workflow
  step :create_user,
       with: User::CreateService

  step :charge_payment,
       with: Payment::ChargeService  # This step fails

  step :send_email,
       with: Email::WelcomeService  # This step never executes
end

MyWorkflow.new(user, params: {}).call
# => raises StepExecutionError with context:
# {
#   workflow: "MyWorkflow",
#   step: :charge_payment,
#   steps_executed: [:create_user],
#   errors: { ... }
# }

Optional step failures don’t raise

class MyWorkflow < BetterService::Workflow
  step :create_user,
       with: User::CreateService

  step :send_email,
       with: Email::WelcomeService,
       optional: true  # Failure won't raise StepExecutionError
end

Instance Attribute Summary

Attributes inherited from BetterServiceError

#code, #context, #original_error, #timestamp

Method Summary

Methods inherited from BetterServiceError

#backtrace, #detailed_message, #initialize, #inspect, #to_h

Constructor Details

This class inherits a constructor from BetterService::BetterServiceError