Exception: UplandMobileCommonsRest::NetworkError

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

Direct Known Subclasses

BadGatewayError, GatewayTimeoutError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ NetworkError

Returns a new instance of NetworkError.



7
8
9
10
11
12
13
14
15
# File 'lib/upland_mobile_commons_rest/errors.rb', line 7

def initialize(params)
  self.status = params[:status]
  self.body = params[:body]

  # Including the parentheses means we call #super with no arguments,
  # rather than passing params along. We do this to avoid the params being
  # treated as the "message" of the exception.
  super()
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



5
6
7
# File 'lib/upland_mobile_commons_rest/errors.rb', line 5

def body
  @body
end

#statusObject

Returns the value of attribute status.



5
6
7
# File 'lib/upland_mobile_commons_rest/errors.rb', line 5

def status
  @status
end

Instance Method Details

#to_sObject



17
18
19
# File 'lib/upland_mobile_commons_rest/errors.rb', line 17

def to_s
  "#{super}\n status: #{status}\n body: #{body}"
end