1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Debug, Error)]
6pub enum Error {
7 #[error("League Client credentials were not found")]
8 CredentialsNotFound,
9
10 #[error("invalid League Client lockfile content")]
11 InvalidLockfile,
12
13 #[error("the client is not connected")]
14 NotConnected,
15
16 #[error("missing required path parameter `{name}` for {method} {path}")]
17 MissingPathParameter {
18 method: &'static str,
19 path: &'static str,
20 name: &'static str,
21 },
22
23 #[error("missing required query parameter `{name}` for {method} {path}")]
24 MissingQueryParameter {
25 method: &'static str,
26 path: &'static str,
27 name: &'static str,
28 },
29
30 #[error("LCU did not become ready after {attempts} attempts")]
31 ReadinessCheckFailed { attempts: usize },
32
33 #[error("LCU returned {status}: {body}")]
34 Lcu {
35 status: reqwest::StatusCode,
36 body: String,
37 },
38
39 #[error("request failed: {0}")]
40 Request(#[from] reqwest::Error),
41
42 #[error("websocket failed: {0}")]
43 WebSocket(#[from] tokio_tungstenite::tungstenite::Error),
44
45 #[error("io failed: {0}")]
46 Io(#[from] std::io::Error),
47
48 #[error("json failed: {0}")]
49 Json(#[from] serde_json::Error),
50
51 #[error("invalid header value: {0}")]
52 Header(#[from] http::header::InvalidHeaderValue),
53
54 #[error("http request build failed: {0}")]
55 Http(#[from] http::Error),
56
57 #[error("url parse failed: {0}")]
58 Url(#[from] url::ParseError),
59}