Exception: Dropbox::ApiError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/dropbox/errors.rb

Overview

Thrown when the API returns an error response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ApiError

Returns a new instance of ApiError.


29
30
31
32
33
34
35
# File 'lib/dropbox/errors.rb', line 29

def initialize(response)
  if response.content_type.mime_type == 'application/json'
    @message = JSON.parse(response)['error_summary']
  else
    @message = response
  end
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message


27
28
29
# File 'lib/dropbox/errors.rb', line 27

def message
  @message
end

Instance Method Details

#to_sObject


37
38
39
# File 'lib/dropbox/errors.rb', line 37

def to_s
  @message.to_s
end