Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit 3e4ab11

Browse files
Merge #44: Add PartialEq, Eq, Clone traits to Error
62774d6 Add PartialEq, Eq, Clone traits to `Error` (wszdexdrf) Pull request description: The `Error` enum variants now only contain Strings ACKs for top commit: danielabrozzoni: utACK 62774d6 Tree-SHA512: 247cbdbcddc081cf5a9b7cd10561d6910964055b989bd6cf12a9025e26507f8ace93bd4f4277019e38044d5a53e284474e88d3044a4a6a1dc20db13af39cf597
2 parents f995dd2 + 62774d6 commit 3e4ab11

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

src/error.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#[derive(Debug)]
1+
#[derive(Debug, PartialEq, Eq, Clone)]
22
pub enum Error {
3-
JSON(serde_json::error::Error),
4-
Utf8(std::str::Utf8Error),
5-
IOError(std::io::Error),
3+
JSON(String),
4+
Utf8(String),
5+
IOError(String),
66
InvalidOption(String),
77
HWIError(String),
88
PyErr(String),
@@ -12,7 +12,7 @@ macro_rules! impl_error {
1212
( $from:ty, $to:ident ) => {
1313
impl std::convert::From<$from> for Error {
1414
fn from(err: $from) -> Self {
15-
Error::$to(err)
15+
Error::$to(err.to_string())
1616
}
1717
}
1818
};
@@ -21,9 +21,4 @@ macro_rules! impl_error {
2121
impl_error!(serde_json::Error, JSON);
2222
impl_error!(std::str::Utf8Error, Utf8);
2323
impl_error!(std::io::Error, IOError);
24-
25-
impl std::convert::From<pyo3::prelude::PyErr> for Error {
26-
fn from(err: pyo3::prelude::PyErr) -> Self {
27-
Error::PyErr(err.to_string())
28-
}
29-
}
24+
impl_error!(pyo3::prelude::PyErr, PyErr);

0 commit comments

Comments
 (0)