Exception: Hooksmith::ProcessorError

Inherits:
Error
  • Object
show all
Defined in:
lib/hooksmith/errors.rb

Overview

Raised when a processor encounters an error during processing.

This error wraps the original exception and provides additional context about which processor failed and for which event.

Examples:

raise Hooksmith::ProcessorError.new(
  'Payment processing failed',
  provider: 'stripe',
  event: 'charge.succeeded',
  processor_class: 'StripeChargeProcessor',
  original_error: original_exception
)

Instance Attribute Summary collapse

Attributes inherited from Error

#event, #provider

Instance Method Summary collapse

Constructor Details

#initialize(message, provider:, event:, processor_class:, original_error: nil) ⇒ ProcessorError

Initializes a new ProcessorError.

Parameters:

  • message (String)

    the error message

  • provider (String, Symbol)

    the provider name

  • event (String, Symbol)

    the event name

  • processor_class (String, Class)

    the processor class name

  • original_error (Exception, nil) (defaults to: nil)

    the original exception



145
146
147
148
149
# File 'lib/hooksmith/errors.rb', line 145

def initialize(message, provider:, event:, processor_class:, original_error: nil)
  @processor_class = processor_class.to_s
  @original_error = original_error
  super(message, provider:, event:)
end

Instance Attribute Details

#original_errorException? (readonly)

Returns the original exception.

Returns:

  • (Exception, nil)

    the original exception



136
137
138
# File 'lib/hooksmith/errors.rb', line 136

def original_error
  @original_error
end

#processor_classString (readonly)

Returns the processor class name.

Returns:

  • (String)

    the processor class name



134
135
136
# File 'lib/hooksmith/errors.rb', line 134

def processor_class
  @processor_class
end