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

Commit 87610d9

Browse files
committed
Merge #47: Implement std::Error for HWI's errors
7f2546f Fix wipe_device (Daniela Brozzoni) 62407d1 Pin once_cell to keep the MSRV to 1.41 (Daniela Brozzoni) ab07d13 Implement std::Error for HWI's errors (Daniela Brozzoni) Pull request description: ACKs for top commit: afilini: ACK 7f2546f Tree-SHA512: b113ee8fe71bf18a54b21f32dda5d47bf5dfdc657624ff5ad00351170bbad7a210b153101f6f22108fd39cdb464fcf22d65d21a124a62994784caec42b0730b8
2 parents 94fb6c7 + 7f2546f commit 87610d9

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ serde = { version = "^1.0", features = ["derive"] }
1515
serde_json = { version = "^1.0" }
1616
pyo3 = { version = "0.15.1", features = ["auto-initialize"]}
1717
base64 = "0.13.0"
18+
once_cell = "=1.14"
1819

1920
[dev-dependencies]
2021
serial_test = "0.6.0"

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 {}

src/interface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ impl HWIClient {
356356
let output = self
357357
.hwilib
358358
.commands
359-
.getattr(py, "toggle_passphrase")?
359+
.getattr(py, "wipe_device")?
360360
.call1(py, func_args)?;
361361
let output = self.hwilib.json_dumps.call1(py, (output,))?;
362362
let status: HWIStatus = deserialize_obj!(&output.to_string())?;

0 commit comments

Comments
 (0)