Exception: SolscanApiRuby::Client::ApiError
- Inherits:
-
StandardError
- Object
- StandardError
- SolscanApiRuby::Client::ApiError
- Defined in:
- lib/solscan_api_ruby/client/api_error.rb
Overview
ApiError is a wrapper class for errors.
Instance Attribute Summary collapse
-
#error ⇒ Hash
readonly
Error message.
-
#status ⇒ Integer
readonly
Error code.
Instance Method Summary collapse
-
#initialize(api_response) ⇒ SolscanApiRuby::Client::ApiError
constructor
Initialize object with json response from the API with error.
Constructor Details
#initialize(api_response) ⇒ SolscanApiRuby::Client::ApiError
Initialize object with json response from the API with error.
22 23 24 25 26 27 28 29 30 |
# File 'lib/solscan_api_ruby/client/api_error.rb', line 22 def initialize(api_response) body = Oj.load(api_response.body) @error = body['error'] @status = body['status'] rescue Oj::ParseError @error = api_response.body @status = api_response.status end |
Instance Attribute Details
#error ⇒ Hash (readonly)
Error message.
15 16 17 |
# File 'lib/solscan_api_ruby/client/api_error.rb', line 15 def error @error end |
#status ⇒ Integer (readonly)
Error code.
11 12 13 |
# File 'lib/solscan_api_ruby/client/api_error.rb', line 11 def status @status end |