Skip to content

Commit 8c6daef

Browse files
committed
Add WriteError variant for custom errors
Signed-off-by: Facundo Tuesca <[email protected]>
1 parent 4eaf45f commit 8c6daef

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/writer.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ use alloc::{fmt, vec};
88
#[derive(PartialEq, Eq, Debug)]
99
pub enum WriteError {
1010
AllocationError,
11+
CustomError(String),
1112
}
1213

1314
impl fmt::Display for WriteError {
1415
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1516
match self {
1617
WriteError::AllocationError => write!(f, "allocation error"),
18+
WriteError::CustomError(s) => write!(f, "{s}"),
1719
}
1820
}
1921
}

0 commit comments

Comments
 (0)