Skip to content

Commit ab07d13

Browse files
Implement std::Error for HWI's errors
1 parent 94fb6c7 commit ab07d13

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/error.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::fmt;
2+
13
#[derive(Debug, PartialEq, Eq, Clone)]
24
pub enum Error {
35
JSON(String),
@@ -22,3 +24,11 @@ impl_error!(serde_json::Error, JSON);
2224
impl_error!(std::str::Utf8Error, Utf8);
2325
impl_error!(std::io::Error, IOError);
2426
impl_error!(pyo3::prelude::PyErr, PyErr);
27+
28+
impl fmt::Display for Error {
29+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30+
write!(f, "{:?}", self)
31+
}
32+
}
33+
34+
impl std::error::Error for Error {}

0 commit comments

Comments
 (0)