pub enum ParserError {
InvalidFileFormat(String),
MissingField(String),
TypeMismatch {
field: String,
expected: String,
},
MissingFileExtension,
NestedError {
section: String,
source: Box<ParserError>,
},
Io(Error),
TomlError(TomlError),
JsonError(Error),
YmlError(ScanError),
}
Expand description
Represents various errors that can occur during the parsing process.
Leverages the thiserror
crate for structured and user-friendly error
handling.
Variants§
InvalidFileFormat(String)
Indicates that the provided file format is unsupported. Occurs when trying to parse a file with an invalid or unrecognized extension.
MissingField(String)
Triggered when a required field is missing in the configuration file. This happens when an expected field is absent.
TypeMismatch
Occurs when there is a type mismatch in a field within the configuration file. This happens when a field’s value type does not match the expected type.
MissingFileExtension
Raised when a file path lacks an extension. Without an extension, determining the file format becomes impossible.
NestedError
Indicates a nested configuration error in a specific section. Provides details about the section and the root cause of the error.
Io(Error)
Reflects standard IO errors encountered during file operations. Arises when issues occur while reading or writing files.
TomlError(TomlError)
Represents a failure in parsing a TOML file. Occurs when the parser encounters invalid TOML syntax or structure.
JsonError(Error)
Represents a failure in parsing a JSON file. Triggered by invalid JSON syntax or structure during parsing.
YmlError(ScanError)
Represents a failure in parsing a YAML file. Triggered by invalid YAML syntax or structure during parsing.