Skip to main content

miden_client/note_transport/
errors.rs

1use alloc::boxed::Box;
2use alloc::string::String;
3use core::error::Error;
4
5use miden_objects::ConversionError;
6use miden_protocol::note::{NoteDetailsCommitment, NoteTag};
7use miden_protocol::utils::serde::DeserializationError;
8use thiserror::Error;
9
10#[derive(Debug, Error)]
11pub enum NoteTransportError {
12    #[error(
13        "note transport is disabled; enable it in the client configuration to send or receive notes via P2P"
14    )]
15    Disabled,
16    #[error("connection error: {0}")]
17    Connection(#[source] Box<dyn Error + Send + Sync + 'static>),
18    #[error("deserialization error: {0}")]
19    Deserialization(#[from] DeserializationError),
20    #[error(
21        "note details commitment {} does not match the header commitment {}",
22        details.to_hex(),
23        header.to_hex()
24    )]
25    NoteDetailsMismatch {
26        header: NoteDetailsCommitment,
27        details: NoteDetailsCommitment,
28    },
29    #[error("note transport returned an invalid note: {0}")]
30    InvalidFetchedNote(#[source] ConversionError),
31    #[error("note transport returned a note with tag {0}, which the client did not request")]
32    UnrequestedTag(NoteTag),
33    #[error("note transport network error: {0}")]
34    Network(String),
35    #[error(
36        "note transport tag backfill did not converge after {0} iterations: the server cursor \
37         keeps advancing but never returns an empty batch"
38    )]
39    #[deprecated(since = "0.17.1", note = "note transport no longer performs per-tag backfills")]
40    PaginationDidNotTerminate(usize),
41}