pub enum Error {
Parse {
message: String,
line: usize,
column: usize,
file: Option<String>,
},
UnknownFormat {
format: String,
},
KeyNotFound {
key: String,
available: Vec<String>,
},
Type {
value: String,
expected_type: String,
actual_type: String,
},
Io {
path: String,
source: Error,
},
Validation {
message: String,
},
General {
message: String,
},
FeatureNotEnabled {
feature: String,
},
Concurrency {
message: String,
},
Noml {
source: NomlError,
},
Internal {
message: String,
context: Option<String>,
},
}
Expand description
Comprehensive error types for all config-lib operations.
This error system provides maximum clarity about what went wrong, where it happened, and how to fix it. Each variant includes enough context for both developers and end users to understand and resolve issues.
Variants§
Parse
Parsing errors - when the input cannot be parsed due to syntax issues
Fields
UnknownFormat
Format detection errors
KeyNotFound
Key access errors - when requesting non-existent keys
Fields
Type
Type conversion errors - when values cannot be converted to requested type
Fields
Io
File I/O errors - wraps std::io::Error with additional context
Validation
General validation errors
General
Generic error for other cases
FeatureNotEnabled
Feature not enabled errors
Concurrency
Concurrency errors - lock failures, thread synchronization issues
Noml
NOML library errors (when using NOML format)
Internal
Internal errors - these should never happen in normal operation
Implementations§
Source§impl Error
impl Error
Sourcepub fn parse(message: impl Into<String>, line: usize, column: usize) -> Self
pub fn parse(message: impl Into<String>, line: usize, column: usize) -> Self
Create a parse error with position information
Sourcepub fn parse_with_file(
message: impl Into<String>,
line: usize,
column: usize,
file: impl Into<String>,
) -> Self
pub fn parse_with_file( message: impl Into<String>, line: usize, column: usize, file: impl Into<String>, ) -> Self
Create a parse error with file context
Sourcepub fn key_not_found(key: impl Into<String>) -> Self
pub fn key_not_found(key: impl Into<String>) -> Self
Create a key not found error
Sourcepub fn key_not_found_with_suggestions(
key: impl Into<String>,
available: Vec<String>,
) -> Self
pub fn key_not_found_with_suggestions( key: impl Into<String>, available: Vec<String>, ) -> Self
Create a key not found error with suggestions
Sourcepub fn type_error(
value: impl Into<String>,
expected: impl Into<String>,
actual: impl Into<String>,
) -> Self
pub fn type_error( value: impl Into<String>, expected: impl Into<String>, actual: impl Into<String>, ) -> Self
Create a type conversion error
Sourcepub fn io(path: impl Into<String>, source: Error) -> Self
pub fn io(path: impl Into<String>, source: Error) -> Self
Create an I/O error with file context
Sourcepub fn unknown_format(format: impl Into<String>) -> Self
pub fn unknown_format(format: impl Into<String>) -> Self
Create an unknown format error
Sourcepub fn feature_not_enabled(feature: impl Into<String>) -> Self
pub fn feature_not_enabled(feature: impl Into<String>) -> Self
Create a feature not enabled error
Sourcepub fn concurrency(message: impl Into<String>) -> Self
pub fn concurrency(message: impl Into<String>) -> Self
Create a concurrency error
Sourcepub fn validation(message: impl Into<String>) -> Self
pub fn validation(message: impl Into<String>) -> Self
Create a validation error