ic_query/icrc/model/
error.rs1#[cfg(feature = "host")]
8use crate::runtime::RuntimeError;
9use thiserror::Error as ThisError;
10
11#[derive(Debug, ThisError)]
18pub enum IcrcError {
19 #[cfg(feature = "host")]
20 #[error("failed to create Tokio runtime for ICRC query: {0}")]
21 Runtime(#[from] RuntimeError),
22
23 #[error("failed to build IC agent for endpoint {endpoint}: {reason}")]
24 AgentBuild { endpoint: String, reason: String },
25
26 #[error("invalid {field}: {reason}")]
27 InvalidPrincipal { field: &'static str, reason: String },
28
29 #[error("invalid subaccount hex: {reason}")]
30 InvalidSubaccountHex { reason: String },
31
32 #[error("invalid subaccount length: expected 32 bytes, got {bytes}")]
33 InvalidSubaccountLength { bytes: usize },
34
35 #[error("failed to encode Candid request for {message}: {reason}")]
36 CandidEncode {
37 message: &'static str,
38 reason: String,
39 },
40
41 #[error("ICRC ledger method {method} failed: {reason}")]
42 AgentCall {
43 method: &'static str,
44 reason: String,
45 },
46
47 #[error("failed to decode Candid response {message}: {reason}")]
48 CandidDecode {
49 message: &'static str,
50 reason: String,
51 },
52}