mpc_relay_server/
error.rs1use axum::extract::ws::Message;
2use mpc_protocol::{MeetingId, SessionId};
3use std::path::PathBuf;
4use thiserror::Error;
5
6#[derive(Debug, Error)]
8pub enum Error {
9 #[error(r#"not a file "{0}""#)]
11 NotFile(PathBuf),
12
13 #[error("permission denied")]
15 PermissionDenied,
16
17 #[error("server config requires path to a key file")]
19 KeyFileRequired,
20
21 #[error(r#"key file "{0}" not found"#)]
23 KeyNotFound(PathBuf),
24
25 #[error("peer already exists")]
28 PeerAlreadyExists,
29
30 #[error(r#"peer "{0}" not found "#)]
32 PeerNotFound(String),
33
34 #[error("no parent directory")]
36 NoParentDir,
37
38 #[error("not handshake protocol state")]
41 NotHandshakeState,
42
43 #[error(r#"meeting "{0}" not found"#)]
45 MeetingNotFound(MeetingId),
46
47 #[error(r#"meeting "{0}" is full"#)]
50 MeetingFull(MeetingId),
51
52 #[error(r#"session "{0}" not found"#)]
54 SessionNotFound(SessionId),
55
56 #[error(r#"session "{0}" does not have participant "{1}""#)]
59 NotSessionParticipant(SessionId, String),
60
61 #[error("session timeout must be greater than the interval")]
64 SessionTimeoutConfig,
65
66 #[error(
69 "session wait timeout must be greater than the wait interval"
70 )]
71 SessionWaitConfig,
72
73 #[error(transparent)]
75 Io(#[from] std::io::Error),
76
77 #[error(transparent)]
79 Protocol(#[from] mpc_protocol::Error),
80
81 #[error(transparent)]
83 Axum(#[from] axum::Error),
84
85 #[error(transparent)]
87 Snow(#[from] mpc_protocol::snow::error::Error),
88
89 #[error(transparent)]
91 Toml(#[from] toml::de::Error),
92
93 #[error(transparent)]
95 HeaderValue(#[from] axum::http::header::InvalidHeaderValue),
96
97 #[error(transparent)]
99 BufferMpscSend(
100 #[from] tokio::sync::mpsc::error::SendError<Vec<u8>>,
101 ),
102
103 #[error(transparent)]
105 MessageMpscSend(
106 #[from] tokio::sync::mpsc::error::SendError<Message>,
107 ),
108}