pub struct NetworkErrorDisplay {
pub error_code: ErrorCode,
pub connection: ConnectionDetails,
pub network_path: Vec<NetworkPathSegment>,
pub env_vars: Vec<EnvVarInfo>,
pub diagnostics: Vec<DiagnosticCommand>,
pub timeout: Option<Duration>,
pub retry_count: Option<u32>,
pub raw_error: Option<String>,
pub caused_by: Vec<String>,
pub custom_message: Option<String>,
}Expand description
NetworkErrorDisplay - Rich error display for network/SSH errors.
Builds on ErrorPanel with network-specific context:
- Connection details (host, port, IP, credentials)
- Network path visualization
- Environment variable display
- Diagnostic command suggestions
Fields§
§error_code: ErrorCodeThe underlying error code
connection: ConnectionDetailsConnection details
network_path: Vec<NetworkPathSegment>Network path segments for visualization
env_vars: Vec<EnvVarInfo>Relevant environment variables
diagnostics: Vec<DiagnosticCommand>Diagnostic command suggestions
timeout: Option<Duration>Connection timeout if applicable
retry_count: Option<u32>Retry information
raw_error: Option<String>Low-level error message from OS/library
caused_by: Vec<String>Error chain (caused by)
custom_message: Option<String>Custom message override
Implementations§
Source§impl NetworkErrorDisplay
impl NetworkErrorDisplay
Sourcepub fn ssh_connection_failed(host: impl Into<String>) -> Self
pub fn ssh_connection_failed(host: impl Into<String>) -> Self
Create display for SSH connection failure (E100).
Sourcepub fn ssh_auth_failed(host: impl Into<String>) -> Self
pub fn ssh_auth_failed(host: impl Into<String>) -> Self
Create display for SSH authentication failure (E101).
Sourcepub fn ssh_key_error(host: impl Into<String>) -> Self
pub fn ssh_key_error(host: impl Into<String>) -> Self
Create display for SSH key error (E102).
Sourcepub fn ssh_host_key_error(host: impl Into<String>) -> Self
pub fn ssh_host_key_error(host: impl Into<String>) -> Self
Create display for SSH host key verification failure (E103).
Sourcepub fn ssh_timeout(host: impl Into<String>) -> Self
pub fn ssh_timeout(host: impl Into<String>) -> Self
Create display for SSH timeout (E104).
Sourcepub fn ssh_session_dropped(host: impl Into<String>) -> Self
pub fn ssh_session_dropped(host: impl Into<String>) -> Self
Create display for SSH session dropped (E105).
Sourcepub fn dns_error(host: impl Into<String>) -> Self
pub fn dns_error(host: impl Into<String>) -> Self
Create display for DNS resolution failure (E106).
Sourcepub fn network_unreachable(host: impl Into<String>) -> Self
pub fn network_unreachable(host: impl Into<String>) -> Self
Create display for network unreachable (E107).
Sourcepub fn connection_refused(host: impl Into<String>) -> Self
pub fn connection_refused(host: impl Into<String>) -> Self
Create display for connection refused (E108).
Sourcepub fn tcp_timeout(host: impl Into<String>) -> Self
pub fn tcp_timeout(host: impl Into<String>) -> Self
Create display for TCP timeout (E109).
Sourcepub fn resolved_ip(self, ip: IpAddr) -> Self
pub fn resolved_ip(self, ip: IpAddr) -> Self
Set the resolved IP address.
Sourcepub fn timeout_secs(self, secs: u64) -> Self
pub fn timeout_secs(self, secs: u64) -> Self
Set the timeout in seconds (convenience method).
Sourcepub fn path_segment(
self,
name: impl Into<String>,
status: PathSegmentStatus,
details: Option<String>,
) -> Self
pub fn path_segment( self, name: impl Into<String>, status: PathSegmentStatus, details: Option<String>, ) -> Self
Add a network path segment.
Sourcepub fn network_path_simple(
self,
local: &str,
daemon: &str,
worker: &str,
failed_at: Option<&str>,
) -> Self
pub fn network_path_simple( self, local: &str, daemon: &str, worker: &str, failed_at: Option<&str>, ) -> Self
Set the full network path with simple status.
Creates a path like: local → daemon → worker
The failed segment is marked based on which name matches failed_at.
Sourcepub fn env_var(self, name: impl Into<String>, value: Option<String>) -> Self
pub fn env_var(self, name: impl Into<String>, value: Option<String>) -> Self
Add an environment variable with its current value.
Sourcepub fn env_var_from_env(self, name: &str) -> Self
pub fn env_var_from_env(self, name: &str) -> Self
Add an environment variable, reading from the current environment.
Sourcepub fn auto_add_ssh_env_vars(self) -> Self
pub fn auto_add_ssh_env_vars(self) -> Self
Automatically add common SSH-related environment variables.
Sourcepub fn add_diagnostic(
self,
description: impl Into<String>,
command: impl Into<String>,
) -> Self
pub fn add_diagnostic( self, description: impl Into<String>, command: impl Into<String>, ) -> Self
Add a diagnostic command suggestion.
Sourcepub fn with_io_error(self, err: &Error) -> Self
pub fn with_io_error(self, err: &Error) -> Self
Extract details from a std::io::Error.
Sourcepub fn to_error_panel(&self) -> ErrorPanel
pub fn to_error_panel(&self) -> ErrorPanel
Convert to an ErrorPanel for rendering.
Sourcepub fn render(&self, ctx: OutputContext)
pub fn render(&self, ctx: OutputContext)
Render the error to stderr.
Uses rich output if supported, otherwise plain text.
Sourcepub fn to_json_compact(&self) -> Result<String>
pub fn to_json_compact(&self) -> Result<String>
Serialize to compact JSON string.
Trait Implementations§
Source§impl Clone for NetworkErrorDisplay
impl Clone for NetworkErrorDisplay
Source§fn clone(&self) -> NetworkErrorDisplay
fn clone(&self) -> NetworkErrorDisplay
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NetworkErrorDisplay
impl Debug for NetworkErrorDisplay
Source§impl<'de> Deserialize<'de> for NetworkErrorDisplay
impl<'de> Deserialize<'de> for NetworkErrorDisplay
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for NetworkErrorDisplay
impl Display for NetworkErrorDisplay
Source§impl Error for NetworkErrorDisplay
impl Error for NetworkErrorDisplay
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()