pub struct ConfigErrorDisplay {Show 16 fields
pub error_code: ErrorCode,
pub location: Option<ConfigLocation>,
pub snippet: Option<ConfigSnippet>,
pub type_mismatch: Option<TypeMismatch>,
pub search_paths: Option<ConfigSearchPaths>,
pub env_var_name: Option<String>,
pub env_var_value: Option<String>,
pub profile_name: Option<String>,
pub worker_id: Option<String>,
pub ssh_key_path: Option<PathBuf>,
pub socket_path: Option<PathBuf>,
pub permission_mode: Option<String>,
pub required_mode: Option<String>,
pub raw_error: Option<String>,
pub caused_by: Vec<String>,
pub custom_message: Option<String>,
}Expand description
ConfigErrorDisplay - Rich error display for configuration errors.
Builds on ErrorPanel with config-specific context:
- File location (path, line, column)
- Content snippets with highlighting
- Expected vs actual values
- Config search paths
- Environment variable issues
Fields§
§error_code: ErrorCodeThe underlying error code.
location: Option<ConfigLocation>Location in the config file.
snippet: Option<ConfigSnippet>Code snippet showing the error.
type_mismatch: Option<TypeMismatch>Type mismatch details.
search_paths: Option<ConfigSearchPaths>Search paths for “not found” errors.
env_var_name: Option<String>Environment variable name (for env errors).
env_var_value: Option<String>Environment variable value (for env errors).
profile_name: Option<String>Profile name (for profile not found).
worker_id: Option<String>Worker ID (for worker config errors).
ssh_key_path: Option<PathBuf>SSH key path (for key errors).
socket_path: Option<PathBuf>Socket path (for socket errors).
permission_mode: Option<String>Permission mode (for permission errors).
required_mode: Option<String>Required permission mode.
raw_error: Option<String>Raw error message from TOML parser or IO.
caused_by: Vec<String>Error chain (caused by).
custom_message: Option<String>Custom message override.
Implementations§
Source§impl ConfigErrorDisplay
impl ConfigErrorDisplay
Sourcepub fn not_found(searched_path: impl Into<PathBuf>) -> Self
pub fn not_found(searched_path: impl Into<PathBuf>) -> Self
Create display for config file not found (E001).
Sourcepub fn read_error(file_path: impl Into<PathBuf>) -> Self
pub fn read_error(file_path: impl Into<PathBuf>) -> Self
Create display for config read error (E002).
Sourcepub fn parse_error(file_path: impl Into<PathBuf>) -> Self
pub fn parse_error(file_path: impl Into<PathBuf>) -> Self
Create display for TOML parse error (E003).
Sourcepub fn validation_error(file_path: impl Into<PathBuf>) -> Self
pub fn validation_error(file_path: impl Into<PathBuf>) -> Self
Create display for validation error (E004).
Sourcepub fn env_error(var_name: impl Into<String>) -> Self
pub fn env_error(var_name: impl Into<String>) -> Self
Create display for environment variable error (E005).
Sourcepub fn profile_not_found(profile_name: impl Into<String>) -> Self
pub fn profile_not_found(profile_name: impl Into<String>) -> Self
Create display for profile not found error (E006).
Sourcepub fn no_workers(config_path: impl Into<PathBuf>) -> Self
pub fn no_workers(config_path: impl Into<PathBuf>) -> Self
Create display for no workers configured error (E007).
Sourcepub fn invalid_worker(worker_id: impl Into<String>) -> Self
pub fn invalid_worker(worker_id: impl Into<String>) -> Self
Create display for invalid worker error (E008).
Sourcepub fn ssh_key_error(key_path: impl Into<PathBuf>) -> Self
pub fn ssh_key_error(key_path: impl Into<PathBuf>) -> Self
Create display for SSH key error (E009).
Sourcepub fn socket_path_error(socket_path: impl Into<PathBuf>) -> Self
pub fn socket_path_error(socket_path: impl Into<PathBuf>) -> Self
Create display for socket path error (E010).
Sourcepub fn snippet_from_content(self, content: &str, context_lines: usize) -> Self
pub fn snippet_from_content(self, content: &str, context_lines: usize) -> Self
Set a multi-line snippet from file content.
Sourcepub fn search_paths(
self,
paths: impl IntoIterator<Item = impl Into<PathBuf>>,
) -> Self
pub fn search_paths( self, paths: impl IntoIterator<Item = impl Into<PathBuf>>, ) -> Self
Set config search paths.
Sourcepub fn permission(
self,
current: impl Into<String>,
required: impl Into<String>,
) -> Self
pub fn permission( self, current: impl Into<String>, required: impl Into<String>, ) -> Self
Set permission mode info.
Sourcepub fn from_toml_error(self, error: &Error) -> Self
pub fn from_toml_error(self, error: &Error) -> Self
Set location from a toml parse error.
Sourcepub fn from_io_error(self, error: &Error) -> Self
pub fn from_io_error(self, error: &Error) -> Self
Set location from an 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.
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 ConfigErrorDisplay
impl Clone for ConfigErrorDisplay
Source§fn clone(&self) -> ConfigErrorDisplay
fn clone(&self) -> ConfigErrorDisplay
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 ConfigErrorDisplay
impl Debug for ConfigErrorDisplay
Source§impl<'de> Deserialize<'de> for ConfigErrorDisplay
impl<'de> Deserialize<'de> for ConfigErrorDisplay
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 ConfigErrorDisplay
impl Display for ConfigErrorDisplay
Source§impl Error for ConfigErrorDisplay
impl Error for ConfigErrorDisplay
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()