Exception: BlockScore::BlockscoreError
- Inherits:
-
StandardError
- Object
- StandardError
- BlockScore::BlockscoreError
- Defined in:
- lib/blockscore/error/blockscore_error.rb
Direct Known Subclasses
AuthorizationError, InternalServerError, NotFoundError, ParameterError, ValidationError
Instance Attribute Summary collapse
-
#error_type ⇒ Object
readonly
Returns the value of attribute error_type.
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
-
#json_body ⇒ Object
readonly
Returns the value of attribute json_body.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(message = nil, json_body = nil, http_status = "400", error_type = "invalid_request_error") ⇒ BlockscoreError
constructor
A new instance of BlockscoreError.
- #to_s ⇒ Object
Constructor Details
#initialize(message = nil, json_body = nil, http_status = "400", error_type = "invalid_request_error") ⇒ BlockscoreError
Returns a new instance of BlockscoreError.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/blockscore/error/blockscore_error.rb', line 9 def initialize(=nil, json_body=nil, http_status="400", error_type="invalid_request_error") super() = "#{json_body["error"]["param"]} #{json_body["error"]["code"]}" @error_type = error_type @http_status = http_status @json_body = json_body @message = "#{} (#{})" end |
Instance Attribute Details
#error_type ⇒ Object (readonly)
Returns the value of attribute error_type.
5 6 7 |
# File 'lib/blockscore/error/blockscore_error.rb', line 5 def error_type @error_type end |
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
6 7 8 |
# File 'lib/blockscore/error/blockscore_error.rb', line 6 def http_status @http_status end |
#json_body ⇒ Object (readonly)
Returns the value of attribute json_body.
7 8 9 |
# File 'lib/blockscore/error/blockscore_error.rb', line 7 def json_body @json_body end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/blockscore/error/blockscore_error.rb', line 4 def @message end |
Instance Method Details
#to_s ⇒ Object
21 22 23 |
# File 'lib/blockscore/error/blockscore_error.rb', line 21 def to_s "Status: #{@http_status}. Type: #{@error_type}, Message: #{@message}" end |