Class: MyApiClient::ErrorHandling::Generator

Inherits:
ServiceAbstract show all
Defined in:
lib/my_api_client/error_handling/generator.rb

Overview

Generates an error handler proc (or symbol)

Constant Summary collapse

ARGUMENTS =
%i[instance response status_code json with raise block].freeze

Instance Method Summary collapse

Methods inherited from ServiceAbstract

call

Constructor Details

#initialize(**options) ⇒ Proc?

Returns the error handler as “Proc”. If no error occurs, return ‘nil`.



28
29
30
31
# File 'lib/my_api_client/error_handling/generator.rb', line 28

def initialize(**options)
  options[:raise] ||= MyApiClient::Error
  verify_and_set_arguments(**options)
end