tsafe_collab/error.rs
1use thiserror::Error;
2
3/// Errors produced by the `CollabRemote` trait and its implementations.
4#[derive(Debug, Error)]
5pub enum CollabError {
6 /// The caller's public key is not a member of the specified team.
7 #[error("not a member of team {team_id}")]
8 NotMember { team_id: String },
9
10 /// The invite token was not found or has expired.
11 #[error("invite not found or expired")]
12 InviteNotFound,
13
14 /// The public key presented during invite confirmation does not match the
15 /// key the invite was originally bound to.
16 #[error("pubkey mismatch in invite confirmation")]
17 PubkeyMismatch,
18
19 /// The remote server returned an unexpected HTTP status.
20 #[error("http error {status}: {body}")]
21 Http { status: u16, body: String },
22
23 /// JSON serialization or deserialization failed.
24 #[error("serialization error: {0}")]
25 Serde(#[from] serde_json::Error),
26
27 /// The remote server could not be reached (network / DNS / TLS failure).
28 #[error("server unreachable: {0}")]
29 Unreachable(String),
30
31 /// A Shamir share could not be reconstructed into a valid 32-byte key.
32 #[error("recovery key reconstruction failed: {0}")]
33 RecoveryFailed(String),
34}