Exception: Hooksmith::PersistenceError

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

Overview

Raised when event persistence fails.

This error is raised when the event store is configured but fails to persist the webhook event.

Examples:

raise Hooksmith::PersistenceError.new(
  'Failed to save webhook event',
  provider: 'stripe',
  event: 'charge.succeeded',
  original_error: ActiveRecord::RecordInvalid.new(...)
)

Instance Attribute Summary collapse

Attributes inherited from Error

#event, #provider

Instance Method Summary collapse

Constructor Details

#initialize(message = 'Failed to persist webhook event', provider: nil, event: nil, original_error: nil) ⇒ PersistenceError

Initializes a new PersistenceError.

Parameters:

  • message (String) (defaults to: 'Failed to persist webhook event')

    the error message

  • provider (String, Symbol, nil) (defaults to: nil)

    the provider name

  • event (String, Symbol, nil) (defaults to: nil)

    the event name

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

    the original exception



225
226
227
228
# File 'lib/hooksmith/errors.rb', line 225

def initialize(message = 'Failed to persist webhook event', provider: nil, event: nil, original_error: nil)
  @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



217
218
219
# File 'lib/hooksmith/errors.rb', line 217

def original_error
  @original_error
end