Skip to content

Commit 1afe6d0

Browse files
committed
Add ioError to DeError
This handles Writer now returning `std::io::Error`
1 parent 6d47998 commit 1afe6d0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/errors.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ pub mod serialize {
318318
pub enum DeError {
319319
/// Serde custom error
320320
Custom(String),
321+
/// IO error from Writer
322+
Io(Arc<IoError>),
321323
/// Xml parsing error
322324
InvalidXml(Error),
323325
/// Cannot parse to integer
@@ -368,6 +370,7 @@ pub mod serialize {
368370
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
369371
match self {
370372
DeError::Custom(s) => write!(f, "{}", s),
373+
DeError::Io(e) => write!(f, "{}", e),
371374
DeError::InvalidXml(e) => write!(f, "{}", e),
372375
DeError::InvalidInt(e) => write!(f, "{}", e),
373376
DeError::InvalidFloat(e) => write!(f, "{}", e),
@@ -409,6 +412,13 @@ pub mod serialize {
409412
}
410413
}
411414

415+
impl From<IoError> for DeError {
416+
#[inline]
417+
fn from(e: IoError) -> Self {
418+
Self::Io(Arc::new(e))
419+
}
420+
}
421+
412422
impl From<Error> for DeError {
413423
#[inline]
414424
fn from(e: Error) -> Self {

0 commit comments

Comments
 (0)