Exception: CirroIOV2::Errors::ClientError

Inherits:
StandardError
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/cirro_io_v2/errors/client_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(faraday_error) ⇒ ClientError

this error class is intended to be used ONLY for 4xx errors www.rubydoc.info/github/lostisland/faraday/Faraday/ClientError



15
16
17
# File 'lib/cirro_io_v2/errors/client_error.rb', line 15

def initialize(faraday_error)
  @faraday_error = faraday_error
end

Instance Attribute Details

#faraday_errorObject (readonly)

Returns the value of attribute faraday_error.



10
11
12
# File 'lib/cirro_io_v2/errors/client_error.rb', line 10

def faraday_error
  @faraday_error
end

Instance Method Details

#messageObject



19
20
21
22
23
24
25
26
# File 'lib/cirro_io_v2/errors/client_error.rb', line 19

def message
  puts faraday_error.response.inspect
  faraday_error.response.then do |response|
    return response.inspect if ENV.fetch('DEBUG_CIRRO_RUBY_CLIENT', false)

    faraday_error.response[:body].presence || faraday_error.try(:message)
  end
end