diff options
Diffstat (limited to 'src/parse.rs')
-rw-r--r-- | src/parse.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/parse.rs b/src/parse.rs index 526b6ce..0249d7f 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -155,3 +155,15 @@ impl Error { &self.e } } + +impl std::fmt::Display for Error { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "failed to parse {}: {}", self.input, self.e) + } +} + +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + Some(&*self.e) + } +} |