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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use cometd::CometError;

/// Kahoot Result
pub type KahootResult<T> = Result<T, KahootError>;

/// Kahoot Error
#[derive(Debug, thiserror::Error)]
pub enum KahootError {
    /// Hyper HTTP Error
    #[error("{0}")]
    Hyper(#[from] hyper::Error),

    /// Invalid http uri
    #[error("{0}")]
    InvalidUrl(#[from] http::uri::InvalidUri),

    /// Invalid Http Status
    #[error("invalid http status {0}")]
    InvalidStatus(http::StatusCode),

    /// A blocking task panicked
    #[error("{0}")]
    TokioJoin(#[from] tokio::task::JoinError),

    /// Json Error
    #[error("{0}")]
    Json(#[from] serde_json::Error),

    /// Comet Error
    #[error("{0}")]
    Comet(#[from] CometError),

    /// Http Error
    #[error("{0}")]
    Http(#[from] http::Error),

    /// Challenge decode error
    #[error("{0}")]
    ChallengeDecodeError(#[from] crate::challenge::DecodeError),

    /// Invalid Game Code
    #[error("invalid game code")]
    InvalidCode,

    /// Missing Token
    #[error("missing token")]
    MissingToken,

    /// Missing name
    #[error("missing name")]
    MissingName,

    /// Invalid Login
    #[error("invalid login")]
    InvalidLogin(crate::LoginResponse),
}