Skip to main content

canic_core/dto/icrc21/
errors.rs

1//! Module: dto::icrc21::errors
2//!
3//! Responsibility: ICRC-21 consent error DTOs.
4//! Does not own: consent evaluation or wallet display behavior.
5//! Boundary: mirrors the external ICRC-21 error surface.
6
7use candid::{CandidType, Deserialize, Nat};
8use serde::Serialize;
9
10//
11// ErrorInfo
12//
13
14#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
15pub struct ErrorInfo {
16    pub description: String,
17}
18
19//
20// Icrc21Error
21//
22
23#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
24pub enum Icrc21Error {
25    UnsupportedCanisterCall(ErrorInfo),
26    ConsentMessageUnavailable(ErrorInfo),
27    InsufficientPayment(ErrorInfo),
28    GenericError {
29        error_code: Nat,
30        description: String,
31    },
32}