Exception: SolanaRpcRuby::ApiError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/solana_rpc_ruby/api_error.rb

Overview

ApiError is a wrapper class for errors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code: nil, message:) ⇒ SolanaRpcRuby::ApiError

Initialize object with json response from the API with error.

Parameters:

  • code (Integer) (defaults to: nil)
  • message (String)

20
21
22
23
24
25
# File 'lib/solana_rpc_ruby/api_error.rb', line 20

def initialize(code: nil, message:)
  @code = code
  @message = message.to_s

  super message
end

Instance Attribute Details

#codeInteger (readonly)

Error code.

Returns:

  • (Integer)

8
9
10
# File 'lib/solana_rpc_ruby/api_error.rb', line 8

def code
  @code
end

#messageString (readonly)

Error message.

Returns:

  • (String)

12
13
14
# File 'lib/solana_rpc_ruby/api_error.rb', line 12

def message
  @message
end