ledger_sdk_device_base/
errors.rs1use serde::{Deserialize, Serialize};
2use thiserror::Error;
3
4#[derive(Clone, Debug, Eq, Error, PartialEq, Deserialize, Serialize)]
6pub enum LedgerAppError<E: std::error::Error> {
7 #[error("This version is not supported")]
9 InvalidVersion,
10 #[error("message cannot be empty")]
12 InvalidEmptyMessage,
13 #[error("The chunk payload type was invalid. First message should be Init")]
15 InvalidChunkPayloadType,
16 #[error("message size is invalid (too big)")]
18 InvalidMessageSize,
19 #[error("received an invalid PK")]
21 InvalidPK,
22 #[error("received no signature back")]
24 NoSignature,
25 #[error("received an invalid signature")]
27 InvalidSignature,
28 #[error("invalid derivation path")]
30 InvalidDerivationPath,
31 #[error("Transport | {0}")]
33 TransportError(#[from] E),
34 #[error("Crypto")]
36 Crypto,
37 #[error("Utf8 conversion error")]
39 Utf8,
40 #[error("response format ID not recognized")]
42 InvalidFormatID,
43 #[error("Couldn't encode string to HEX")]
45 HexEncode,
46 #[error("App Error: | {0} {1}")]
48 AppSpecific(u16, String),
49 #[error("Unknown error: {0}")]
51 Unknown(u16),
52}