Skip to content

Commit abe5ffd

Browse files
committed
impl Error for ParseError
1 parent cd1df87 commit abe5ffd

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/parser.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,24 @@ impl From<RecordParseError> for ParseError {
7070
}
7171
}
7272

73+
impl Error for ParseError {
74+
fn description(&self) -> &str {
75+
match self {
76+
&ParseError::IOError(ref err) => err.description(),
77+
&ParseError::RecordParseError(ref err) => err.description(),
78+
}
79+
}
80+
}
81+
82+
impl Display for ParseError {
83+
fn fmt(&self, formatter: &mut Formatter) -> FormatResult {
84+
match self {
85+
&ParseError::IOError(ref err) => err.fmt(formatter),
86+
&ParseError::RecordParseError(ref err) => err.fmt(formatter),
87+
}
88+
}
89+
}
90+
7391
/// Parse the record one line at a time
7492
///
7593
/// # Examples

0 commit comments

Comments
 (0)