Exception: X::NetworkError
- Includes:
- RequestContext
- Defined in:
- x-core/lib/x/core/errors/network_error.rb
Overview
Raised when a request never reached the API, or its response never arrived
It stands for every error a socket raises: a refused, reset, or dropped connection, a host that cannot be resolved, a TLS handshake that failed, a proxy that refused to open a tunnel, and the open, read, and write timeouts of the client. Whether the API acted on the request is unknown, so a client sends an idempotent request again after one, and leaves a POST to the caller; see Client#initialize.
The message names the request that failed, and #http_method and #uri read it, since nothing of a request that got no response is left to read it from.
Instance Method Summary collapse
-
#http_method ⇒ Symbol?
The HTTP method the request that failed was sent with.
-
#initialize(message = nil, http_method: nil, uri: nil) ⇒ NetworkError
constructor
Initialize a new NetworkError.
-
#uri ⇒ URI::Generic?
The URI the request that failed was sent to.
Constructor Details
#initialize(message = nil, http_method: nil, uri: nil) ⇒ NetworkError
Initialize a new NetworkError
Public, so that code that rescues a NetworkError can be tested with one built by hand, as Connection builds one for the errors a socket raises, or raised with no message, as any exception is. The error names the request, when given its method and URI, as x-core names the request that failed.
52 53 54 55 |
# File 'x-core/lib/x/core/errors/network_error.rb', line 52 def initialize( = nil, http_method: nil, uri: nil) name_request(http_method, uri) super( && ()) end |
Instance Method Details
#http_method ⇒ Symbol?
The HTTP method the request that failed was sent with
|
|
# File 'x-core/lib/x/core/errors/network_error.rb', line 25
|
#uri ⇒ URI::Generic?
The URI the request that failed was sent to
|
|
# File 'x-core/lib/x/core/errors/network_error.rb', line 25
|