Skip to content

Errors

All Solace errors descend from Solace::Errors::Error, so you can rescue the whole library with one class — or catch a specific failure mode. They live under lib/solace/errors/.

Hierarchy

StandardError
└─ Solace::Errors::Error
   ├─ Solace::Errors::ConnectionError
   │  ├─ Solace::Errors::HTTPError
   │  └─ Solace::Errors::RPCError
   ├─ Solace::Errors::ParseError
   └─ Solace::Errors::ConfirmationTimeout
ErrorRaised when
ErrorBase class for everything Solace raises.
ConnectionErrorBase for transport/RPC failures.
HTTPErrorA non-success HTTP response from the RPC node (carries code and body).
RPCErrorThe node returned a JSON-RPC error (carries rpc_code, rpc_message, rpc_data).
ParseErrorA response body couldn't be parsed (carries the offending body).
ConfirmationTimeoutwait_for_confirmed_signature didn't reach the target commitment in time (carries signature, commitment, timeout).

Handling them

Rescue broadly, or narrow to the case you care about:

ruby
begin
  result = connection.send_transaction(tx.serialize)
  connection.wait_for_confirmed_signature { result['result'] }
rescue Solace::Errors::ConfirmationTimeout => e
  warn "Not confirmed in #{e.timeout}s: #{e.signature}"
rescue Solace::Errors::RPCError => e
  warn "RPC rejected it (#{e.rpc_code}): #{e.rpc_message}"
rescue Solace::Errors::Error => e
  warn "Solace error: #{e.message}"
end

Because HTTPError and RPCError are both ConnectionError, rescuing ConnectionError catches any node-communication problem; rescuing Solace::Errors::Error catches that plus parse and confirmation failures.

A Ruby SDK for Solana