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(message:, error_class: nil, code: nil) ⇒ 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
26
27
28
# File 'lib/solana_rpc_ruby/api_error.rb', line 20

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

  additional_info

  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