pub enum SourceError {
NotFound(String),
ReadFailed(String),
ParseFailed {
path: String,
format: String,
message: String,
},
InvalidFormat {
expected: String,
found: String,
},
Io(String),
EnvVar(String),
Network(String),
Serialization(String),
InvalidPath(PathBuf),
Unsupported(String),
Validation(String),
Custom(String),
}Expand description
Error type for source operations.
This enum covers all possible errors that can occur during source loading, parsing, and processing.
Variants§
NotFound(String)
Source not found.
ReadFailed(String)
Failed to read source.
ParseFailed
Failed to parse source content.
Fields
InvalidFormat
Invalid format detected.
Io(String)
IO error.
EnvVar(String)
Environment variable error.
Network(String)
Network error for remote sources.
Serialization(String)
Serialization/deserialization error.
InvalidPath(PathBuf)
Invalid source path.
Unsupported(String)
Unsupported operation.
Validation(String)
Source validation failed.
Custom(String)
Custom error.
Implementations§
Source§impl SourceError
impl SourceError
Sourcepub fn read_failed(source: &str) -> Self
pub fn read_failed(source: &str) -> Self
Create a read failed error.
Sourcepub fn parse_failed(path: &str, format: &str, message: &str) -> Self
pub fn parse_failed(path: &str, format: &str, message: &str) -> Self
Create a parse failed error.
Sourcepub fn invalid_format(expected: &str, found: &str) -> Self
pub fn invalid_format(expected: &str, found: &str) -> Self
Create an invalid format error.
Sourcepub fn serialization(message: &str) -> Self
pub fn serialization(message: &str) -> Self
Create a serialization error.
Sourcepub const fn invalid_path(path: PathBuf) -> Self
pub const fn invalid_path(path: PathBuf) -> Self
Create an invalid path error.
Sourcepub fn unsupported(operation: &str) -> Self
pub fn unsupported(operation: &str) -> Self
Create an unsupported operation error.
Sourcepub fn validation(message: &str) -> Self
pub fn validation(message: &str) -> Self
Create a validation error.
Sourcepub const fn is_not_found(&self) -> bool
pub const fn is_not_found(&self) -> bool
Check if this is a not found error.
Sourcepub const fn is_parse_failed(&self) -> bool
pub const fn is_parse_failed(&self) -> bool
Check if this is a parse error.
Sourcepub const fn is_network(&self) -> bool
pub const fn is_network(&self) -> bool
Check if this is a network error.
Trait Implementations§
Source§impl Debug for SourceError
impl Debug for SourceError
Source§impl Display for SourceError
impl Display for SourceError
Source§impl Error for SourceError
impl Error for SourceError
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()
Source§impl From<Error> for SourceError
impl From<Error> for SourceError
Source§impl From<Error> for SourceError
Available on crate feature json only.
impl From<Error> for SourceError
json only.