gstp/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur in GSTP operations.
4#[derive(Debug, Error)]
5pub enum Error {
6    /// Missing required encryption key.
7    #[error("sender must have an encryption key")]
8    SenderMissingEncryptionKey,
9
10    /// Missing required encryption key for recipient.
11    #[error("recipient must have an encryption key")]
12    RecipientMissingEncryptionKey,
13
14    /// Missing required verification key for sender.
15    #[error("sender must have a verification key")]
16    SenderMissingVerificationKey,
17
18    /// Continuation has expired.
19    #[error("continuation expired")]
20    ContinuationExpired,
21
22    /// Continuation ID is invalid.
23    #[error("continuation ID invalid")]
24    ContinuationIdInvalid,
25
26    /// Peer continuation must be encrypted.
27    #[error("peer continuation must be encrypted")]
28    PeerContinuationNotEncrypted,
29
30    /// Requests must contain a peer continuation.
31    #[error("requests must contain a peer continuation")]
32    MissingPeerContinuation,
33
34    /// Error from bc-envelope operations.
35    #[error(transparent)]
36    Envelope(#[from] bc_envelope::Error),
37
38    /// Error from bc-xid operations.
39    #[error(transparent)]
40    XID(#[from] bc_xid::Error),
41}
42
43pub type Result<T> = std::result::Result<T, Error>;