mega_security_rs/
errors.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use thiserror::Error;

#[derive(Error, Debug, PartialEq)]
pub enum ServerError {
    #[error("client with id `{0}` is not registered")]
    ClientNotFound(String),
    #[error("autentication of user with id `{0}` failed")]
    AutenticationFailed(String),
    #[error("client with id `{0}` already exists")]
    ClientAlreadyRegistred(String),
    #[error("session id does not exist")]
    SessionIdNotFound,
}

#[derive(Error, Debug)]
pub enum ClientError {
    #[error("could not decrypt keys")]
    FailureToDecrypt,
}