You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
651 B
43 lines
651 B
//! Config parsing error
|
|
use super::*;
|
|
use std::{
|
|
io,
|
|
};
|
|
|
|
#[derive(Debug)]
|
|
pub enum Error {
|
|
IO(io::Error),
|
|
|
|
Unknown,
|
|
}
|
|
|
|
impl std::error::Error for Error
|
|
{
|
|
fn source(&self) -> Option<&(dyn std::error::Error + 'static)>
|
|
{
|
|
Some(match &self {
|
|
Self::IO(io) => io,
|
|
_ => return None,
|
|
})
|
|
}
|
|
}
|
|
impl std::fmt::Display for Error
|
|
{
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
|
|
{
|
|
match self {
|
|
Self::IO(io) => write!(f, "i/o error: {}", io),
|
|
Self::Unknown => write!(f, "unknown error")
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<io::Error> for Error
|
|
{
|
|
fn from(from: io::Error) -> Self
|
|
{
|
|
Self::IO(from)
|
|
}
|
|
}
|
|
|