pub struct NetError { /* private fields */ }Expand description
An error classification, safe context, and an optional shared original cause.
Formatting never includes arbitrary source text. Inspect source() explicitly
when the original third-party or application details are required.
Implementations§
Source§impl NetError
impl NetError
Sourcepub fn network_monitor_diagnostics(&self) -> Option<Value>
pub fn network_monitor_diagnostics(&self) -> Option<Value>
Collect fixed, privacy-safe fields for a network monitor failure event.
Returns None for an error without a monitor stage or diagnostic. The
JSON object always contains kind, stage, phase, elapsed_ms,
timeout_ms, operation, hresult and os_error_code; unknown values
are JSON null. Phases and operations use their stable as_str() names,
while kind and stage use the existing enum names. Milliseconds truncate
submillisecond values and saturate at u64::MAX.
hresult comes only from a returned Windows reachability failure and is
formatted as 0xXXXXXXXX. os_error_code comes only from an original
std::io::Error::raw_os_error in the bounded source chain. These are
different error-code namespaces; this method never converts one into the
other or invents a HRESULT for a timed-out native call.
No arbitrary source message, network name, machine name or application metadata is formatted or included. This method does not enable logging or send events; call it before replacing this error with its string.
Source§impl NetError
impl NetError
Sourcepub fn from_http_status(status: StatusCode) -> Self
pub fn from_http_status(status: StatusCode) -> Self
Creates an error classified from an HTTP status returned by a protocol or upgrade operation.
Sourcepub fn context(&self) -> &ErrorContext
pub fn context(&self) -> &ErrorContext
Returns structured context captured while processing the failure.
Sourcepub fn retry_report(&self) -> Option<&RetryReport>
pub fn retry_report(&self) -> Option<&RetryReport>
Returns retry statistics for the logical operation that produced this error.
Errors constructed outside a submitted operation have no report. Attaching a report preserves the original classification, source and protocol context.
Sourcepub fn ws_timeout_phase(&self) -> Option<WsTimeoutPhase>
pub fn ws_timeout_phase(&self) -> Option<WsTimeoutPhase>
Returns the expired WebSocket operation budget, or None for other failures.
Attempt is independent of the write and response timers; admission and
total timeouts always terminate the logical operation.
Sourcepub fn http_status(&self) -> Option<StatusCode>
pub fn http_status(&self) -> Option<StatusCode>
Returns the HTTP status associated with the failure, if one was recorded.
Sourcepub fn config_error(&self) -> Option<&ConfigError>
pub fn config_error(&self) -> Option<&ConfigError>
Returns structured configuration details, if the failure came from invalid input.
Sourcepub fn io_kind(&self) -> Option<ErrorKind>
pub fn io_kind(&self) -> Option<ErrorKind>
The first retained I/O category in the source chain, if available.
Trait Implementations§
Source§impl Error for NetError
impl Error for NetError
Source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()