Add SpecificIoError trait support for tagged error
This commit is contained in:
parent
44a44a50d1
commit
4085fc522c
|
@ -13,6 +13,8 @@ use crate::{
|
|||
ignore::IgnoreFilterer,
|
||||
};
|
||||
|
||||
use super::SpecificIoError;
|
||||
|
||||
/// Errors occurring from reconfigs.
|
||||
#[derive(Debug, Diagnostic, Error)]
|
||||
#[non_exhaustive]
|
||||
|
@ -158,3 +160,18 @@ impl From<TaggedFiltererError> for RuntimeError {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> SpecificIoError<Result<T, TaggedFiltererError>> for Result<T, std::io::Error> {
|
||||
fn about(self, context: &'static str) -> Result<T, TaggedFiltererError> {
|
||||
self.map_err(|err| err.about(context))
|
||||
}
|
||||
}
|
||||
|
||||
impl SpecificIoError<TaggedFiltererError> for std::io::Error {
|
||||
fn about(self, context: &'static str) -> TaggedFiltererError {
|
||||
TaggedFiltererError::IoError {
|
||||
about: context,
|
||||
err: self,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue