pub struct Error {
pub kind: ErrorKind,
pub phase: Phase,
pub status_word: Option<StatusWord>,
pub application_status: Option<u8>,
pub reference: Option<SecretReference>,
pub retries_remaining: Option<u8>,
}Expand description
Owned, cloneable protocol failure with no secret payload. Display is diagnostic English; applications own localization and transport errors.
Fields§
§kind: ErrorKindSemantic failure category.
phase: PhaseCommand/parser context used to classify the error.
status_word: Option<StatusWord>Original status when the failure came from a card status word.
application_status: Option<u8>Applet-level non-ISO status byte reported in the response payload
(e.g. the CTAP status byte), when the failure came from such a status.
Distinct from status_word, which is always an ISO 7816 SW1-SW2.
reference: Option<SecretReference>Credential reference when known; absent for non-authentication failures.
retries_remaining: Option<u8>Retry count from an authentication 63Cx status; absent when not reported.
Implementations§
Source§impl Error
impl Error
Sourcepub fn new(kind: ErrorKind) -> Self
pub fn new(kind: ErrorKind) -> Self
Construct a failure in Construction phase with no card status or credential.
Sourcepub fn at(self, phase: Phase) -> Self
pub fn at(self, phase: Phase) -> Self
Replace the phase while retaining all other error details.
Sourcepub fn status(
sw: StatusWord,
phase: Phase,
reference: Option<SecretReference>,
) -> Self
pub fn status( sw: StatusWord, phase: Phase, reference: Option<SecretReference>, ) -> Self
Classify a card status using its phase and optional credential reference.
SELECT 6A82/6A88 maps to UnsupportedDevice; elsewhere it maps to NotFound. 63Cx is AuthenticationFailed only with a credential reference. Unknown statuses remain UnexpectedStatusWord with their raw value. This function is for failure paths: even 9000 maps to UnexpectedStatusWord here.
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
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()