Method: CloudFS::RestAdapter::Errors::ClientError#initialize

Defined in:
lib/cloudfs/client/error.rb

#initialize(error, request = {}) ⇒ ClientError

Returns a new instance of ClientError.

Parameters:

  • error (Exception, String)
  • request (Hash) (defaults to: {})

    request context



163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/cloudfs/client/error.rb', line 163

def initialize(error, request={})
  if error.respond_to?(:backtrace)
    super(error.message)
    @original = error
    @code = -1
    @request = request
    # nothing informative to provide here
    @response = {:content => 'HTTPClient Error',
                 :content_type => 'application/text', :code => -1}
  else
    super(error.to_s)
  end
end