Sha256: 3cdf43c41d8b586cec0ff2037a57b68d2c4eac6e86eeea9e648f714a715b5bc4

Contents?: true

Size: 422 Bytes

Versions: 5

Compression:

Stored size: 422 Bytes

Contents

class StripeModelCallbacks::Configuration
  def self.current
    @current ||= new
  end

  def initialize
    @on_error_callbacks = []
  end

  def on_error(&blk)
    @on_error_callbacks << blk
  end

  def with_error_handling(args: nil)
    yield
  rescue => e # rubocop:disable Style/RescueStandardError
    @on_error_callbacks.each do |callback|
      callback.call(args: args, error: e)
    end

    raise e
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
stripe_model_callbacks-0.1.7 lib/stripe_model_callbacks/configuration.rb
stripe_model_callbacks-0.1.6 lib/stripe_model_callbacks/configuration.rb
stripe_model_callbacks-0.1.5 lib/stripe_model_callbacks/configuration.rb
stripe_model_callbacks-0.1.4 lib/stripe_model_callbacks/configuration.rb
stripe_model_callbacks-0.1.3 lib/stripe_model_callbacks/configuration.rb