#[non_exhaustive]pub enum DeviceError {
Show 17 variants
NotConnected,
ActionCancelled,
PinRequired,
InvalidPin,
PinCancelled,
PassphraseRequired,
PassphraseCancelled,
InvalidState,
NotInitialized,
FirmwareUpdateRequired,
SeedNotBackedUp,
NotSupported(String),
Failure {
code: Option<i32>,
message: String,
},
DeviceError {
code: i32,
message: String,
},
ButtonRequest(String),
ProtobufDecode(String),
InvalidInput(String),
}Expand description
Device errors returned by the Trezor.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotConnected
Device not connected or session not acquired
ActionCancelled
Action cancelled on device
PinRequired
PIN is required
InvalidPin
Invalid PIN entered
PinCancelled
PIN entry cancelled
PassphraseRequired
Passphrase is required
PassphraseCancelled
Passphrase entry cancelled
InvalidState
The device’s derived session state did not match the expected state,
i.e. a different passphrase was entered than the one that created the
remembered wallet. Mirrors trezor-suite’s Device_InvalidState.
NotInitialized
Device is not initialized
FirmwareUpdateRequired
Device needs firmware update
SeedNotBackedUp
Seed is not backed up
NotSupported(String)
Feature not supported
Failure
Device returned failure
DeviceError
Device returned error response
ButtonRequest(String)
Button request (informational)
ProtobufDecode(String)
Protobuf decode error
InvalidInput(String)
Invalid input
Implementations§
Source§impl DeviceError
impl DeviceError
Sourcepub fn from_failure(code: Option<i32>, message: String) -> Self
pub fn from_failure(code: Option<i32>, message: String) -> Self
Map a Trezor protocol Failure (a FailureType code plus message) into
a typed DeviceError. Known PIN/action codes become their typed
variants so callers (and downstream FFI consumers) can react to a wrong
PIN, a cancelled PIN entry, etc.; unknown codes fall back to the generic
DeviceError so existing behavior is preserved.
Codes match FailureType in proto/messages-common.proto.
Trait Implementations§
Source§impl Debug for DeviceError
impl Debug for DeviceError
Source§impl Display for DeviceError
impl Display for DeviceError
Source§impl Error for DeviceError
impl Error for DeviceError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()