Skip to main content

trellis_auth/
error.rs

1use std::io;
2
3/// Errors returned by Trellis auth and admin-session helpers.
4#[derive(Debug, thiserror::Error)]
5pub enum TrellisAuthError {
6    #[error("invalid contract json: {0}")]
7    ContractJson(#[from] serde_json::Error),
8
9    #[error("invalid url: {0}")]
10    Url(#[from] url::ParseError),
11
12    #[error("http client error: {0}")]
13    Http(#[from] reqwest::Error),
14
15    #[error("io error: {0}")]
16    Io(#[from] io::Error),
17
18    #[error("trellis client error: {0}")]
19    TrellisClient(#[from] trellis_client::TrellisClientError),
20
21    #[error("timed out waiting for browser login")]
22    LoginTimedOut,
23
24    #[error("browser login was interrupted")]
25    LoginInterrupted,
26
27    #[error("invalid callback request")]
28    InvalidCallbackRequest,
29
30    #[error("missing auth token in callback")]
31    MissingAuthToken,
32
33    #[error("auth flow failed: {0}")]
34    AuthFlowFailed(String),
35
36    #[error("bind failed: {0} {1}")]
37    BindHttpFailure(u16, String),
38
39    #[error("unexpected bind status: {0}")]
40    UnexpectedBindStatus(String),
41
42    #[error("logged in user is not an admin")]
43    NotAdmin,
44}