Exception: BlockBee::APIError
- Inherits:
-
StandardError
- Object
- StandardError
- BlockBee::APIError
- Defined in:
- lib/blockbee.rb
Instance Attribute Summary collapse
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message, status_code) ⇒ APIError
constructor
A new instance of APIError.
Constructor Details
#initialize(message, status_code) ⇒ APIError
Returns a new instance of APIError.
11 12 13 14 |
# File 'lib/blockbee.rb', line 11 def initialize(, status_code) super() @status_code = status_code end |
Instance Attribute Details
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
9 10 11 |
# File 'lib/blockbee.rb', line 9 def status_code @status_code end |
Class Method Details
.from_status_code(status_code, message) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/blockbee.rb', line 16 def self.from_status_code(status_code, ) case status_code when 400 new("Bad Request: #{}", 400) when 401 new("Unauthorized: #{}", 401) when 403 new("Forbidden: #{}", 403) when 404 new("Not Found: #{}", 404) when 500 new("Internal Server Error", 500) else new("Unexpected Error: #{}", status_code) end end |