summaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
authorFxQnLr <[email protected]>2024-02-26 15:50:00 +0100
committerGitHub <[email protected]>2024-02-26 15:50:00 +0100
commit31a57425a76cae121c5d8ef5b0f2442ca6a9ee61 (patch)
tree19151fea3c1548d6298c0fb819e2a776d9aca74a /src/error.rs
parent0967f44161e972ff1a8482fd168897a3b183bae3 (diff)
parentffedfd00a46147b225c834187fc298e88e60d0c5 (diff)
downloadwebol-cli-31a57425a76cae121c5d8ef5b0f2442ca6a9ee61.tar
webol-cli-31a57425a76cae121c5d8ef5b0f2442ca6a9ee61.tar.gz
webol-cli-31a57425a76cae121c5d8ef5b0f2442ca6a9ee61.zip
Merge pull request #7 from FxQnLr/webol-dev-9
Webol dev 9
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs56
1 files changed, 39 insertions, 17 deletions
diff --git a/src/error.rs b/src/error.rs
index f15c60a..1e6eac1 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -1,21 +1,43 @@
1use std::{fmt::Debug, num::ParseIntError}; 1use std::{fmt::Debug, num::ParseIntError};
2 2
3pub enum CliError { 3use reqwest::header::InvalidHeaderValue;
4 Reqwest(reqwest::Error),
5 Config(config::ConfigError),
6 Serde(serde_json::Error),
7 Parse(ParseIntError),
8 WsResponse,
9}
10 4
11impl Debug for CliError { 5#[derive(Debug, thiserror::Error)]
12 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 6pub enum Error {
13 match self { 7 #[error("request: {source}")]
14 Self::Reqwest(err) => { err.fmt(f) }, 8 Reqwest {
15 Self::Config(err) => { err.fmt(f) }, 9 #[from]
16 Self::Serde(err) => { err.fmt(f) }, 10 source: reqwest::Error,
17 Self::Parse(err) => { err.fmt(f) }, 11 },
18 Self::WsResponse => { f.write_str("Error in Response") }, 12 #[error("config: {source}")]
19 } 13 Config {
20 } 14 #[from]
15 source: config::ConfigError,
16 },
17 #[error("serde: {source}")]
18 Serde {
19 #[from]
20 source: serde_json::Error,
21 },
22 #[error("parse int: {source}")]
23 Parse {
24 #[from]
25 source: ParseIntError,
26 },
27 #[error("parse header: {source}")]
28 InvalidHeaderValue {
29 #[from]
30 source: InvalidHeaderValue,
31 },
32 #[error("tungstenite: {source}")]
33 Tungstenite {
34 #[from]
35 source: tokio_tungstenite::tungstenite::Error,
36 },
37 #[error("faulty websocket response")]
38 WsResponse,
39 #[error("authorization failed")]
40 Authorization,
41 #[error("Http error status: {0}")]
42 HttpStatus(u16),
21} 43}