Class: ApiResponse::Processor::Failure

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Defined in:
lib/api_response/processor/failure.rb

Instance Method Summary collapse

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/api_response/processor/failure.rb', line 14

def call
  return response if config.raw_response
  return build_error_monad if config.monad

  begin
    return response_body if config.error_json
  rescue StandardError
    return config.default_return_value || response.body
  end

  config.default_return_value
end