Exception: PacklinkLite::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/packlink_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.



5
6
7
8
9
# File 'lib/packlink_lite/errors.rb', line 5

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.



3
4
5
# File 'lib/packlink_lite/errors.rb', line 3

def http_body
  @http_body
end

#http_codeObject (readonly)

Returns the value of attribute http_code.



3
4
5
# File 'lib/packlink_lite/errors.rb', line 3

def http_code
  @http_code
end

Instance Method Details

#inspectObject



11
12
13
# File 'lib/packlink_lite/errors.rb', line 11

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

#messageObject



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

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

#to_sObject



19
20
21
# File 'lib/packlink_lite/errors.rb', line 19

def to_s
  inspect
end