Exception: BoxtalLite::Error

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

Direct Known Subclasses

ResponseError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, http_body = nil, http_code = nil) ⇒ Error

Returns a new instance of Error.



6
7
8
9
10
# File 'lib/boxtal_lite/errors.rb', line 6

def initialize(message, http_body = nil, http_code = nil)
  @message = message
  @http_body = http_body
  @http_code = http_code
end

Instance Attribute Details

#http_bodyObject (readonly)

Returns the value of attribute http_body.



4
5
6
# File 'lib/boxtal_lite/errors.rb', line 4

def http_body
  @http_body
end

#http_codeObject (readonly)

Returns the value of attribute http_code.



4
5
6
# File 'lib/boxtal_lite/errors.rb', line 4

def http_code
  @http_code
end

Instance Method Details

#inspectObject



12
13
14
# File 'lib/boxtal_lite/errors.rb', line 12

def inspect
  "#{message}: #{http_body}"
end

#messageObject



16
17
18
# File 'lib/boxtal_lite/errors.rb', line 16

def message
  @message || self.class.to_s
end

#to_sObject



20
21
22
# File 'lib/boxtal_lite/errors.rb', line 20

def to_s
  inspect
end