Exception: BetterService::Errors::Runtime::ExecutionError

Inherits:
RuntimeError show all
Defined in:
lib/better_service/errors/runtime/execution_error.rb

Overview

Raised when unexpected error occurs during service execution

This error wraps unexpected StandardError exceptions that occur during the service’s search, process, transform, or respond phases.

Examples:

Unexpected error in service

class MyService < BetterService::Services::Base
  schema { }

  process_with do |data|
    # Some operation that fails unexpectedly
    third_party_api.call  # raises SocketError
  end
end

MyService.new(user, params: {}).call
# => raises ExecutionError wrapping SocketError

Instance Attribute Summary

Attributes inherited from BetterServiceError

#code, #context, #original_error, #timestamp

Instance Method Summary collapse

Methods inherited from BetterServiceError

#backtrace, #detailed_message, #inspect, #to_h

Constructor Details

#initialize(message = "Execution failed", code: :execution_error, context: {}, original_error: nil) ⇒ ExecutionError



24
25
26
# File 'lib/better_service/errors/runtime/execution_error.rb', line 24

def initialize(message = "Execution failed", code: :execution_error, context: {}, original_error: nil)
  super(message, code: code, context: context, original_error: original_error)
end