Exception: Solace::Errors::HTTPError
- Inherits:
-
ConnectionError
- Object
- StandardError
- Error
- ConnectionError
- Solace::Errors::HTTPError
- Defined in:
- lib/solace/errors/http_error.rb
Overview
Raised when an HTTP request to the RPC node fails.
This error is raised for network-level failures when communicating with the Solana RPC node, including connection timeouts, DNS resolution failures, and HTTP protocol errors. This is distinct from RPC-level errors, which are raised as RPCError.
Instance Attribute Summary collapse
- #body ⇒ Object readonly
- #code ⇒ Object readonly
Class Method Summary collapse
-
.format_response(response) ⇒ Solace::Errors::HTTPError
Formats a response to an error.
-
.format_timeout_error(error) ⇒ Solace::Errors::HTTPError
Formats timeout errors.
-
.format_transport_error(error) ⇒ Solace::Errors::HTTPError
Formats transport errors.
Instance Method Summary collapse
-
#initialize(message, code:, body: nil) ⇒ HTTPError
constructor
A new instance of HTTPError.
Constructor Details
#initialize(message, code:, body: nil) ⇒ HTTPError
Returns a new instance of HTTPError.
27 28 29 30 31 |
# File 'lib/solace/errors/http_error.rb', line 27 def initialize(, code:, body: nil) super() @code = code @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
22 23 24 |
# File 'lib/solace/errors/http_error.rb', line 22 def body @body end |
#code ⇒ Object (readonly)
22 23 24 |
# File 'lib/solace/errors/http_error.rb', line 22 def code @code end |
Class Method Details
.format_response(response) ⇒ Solace::Errors::HTTPError
Formats a response to an error
37 38 39 |
# File 'lib/solace/errors/http_error.rb', line 37 def self.format_response(response) new("HTTP error: #{response.}", code: response.code.to_i, body: response.body) end |
.format_timeout_error(error) ⇒ Solace::Errors::HTTPError
Formats timeout errors
53 54 55 |
# File 'lib/solace/errors/http_error.rb', line 53 def self.format_timeout_error(error) new("HTTP timeout: #{error.class}", code: 408) end |
.format_transport_error(error) ⇒ Solace::Errors::HTTPError
Formats transport errors
45 46 47 |
# File 'lib/solace/errors/http_error.rb', line 45 def self.format_transport_error(error) new("HTTP transport error: #{error.}", code: 0) end |