summaryrefslogtreecommitdiff
path: root/legacy_actions/src/connection/error.rs
blob: 1a4e221fd00f58986248801956a98451562fd182 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use std::io;
use thiserror::Error;
use vcs_data::data::member::MemberId;

#[derive(Error, Debug, Clone)]
pub enum ConnectionError {
    #[error("I/O error: {0}")]
    Io(String),
}

#[derive(Error, Debug, Clone)]
pub enum ProcessActionError {
    #[error("Action `{0}` not registered")]
    ActionNotRegistered(String),

    #[error("Authorize `{0}` failed")]
    AuthorizeFailed(MemberId),

    #[error("Authorize host `{0}` failed")]
    AuthorizeHostFailed(MemberId),
}

impl From<io::Error> for ConnectionError {
    fn from(error: io::Error) -> Self {
        ConnectionError::Io(error.to_string())
    }
}