Skip to content
This repository was archived by the owner on Jul 6, 2024. It is now read-only.

Commit 11369b9

Browse files
committed
feat: Separate Error for Encoding/Decoding errors
1 parent 32ced45 commit 11369b9

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "proton-api-rs"
33
authors = ["Leander Beernaert <lbb-dev@pm.me>"]
4-
version = "0.9.0"
4+
version = "0.10.0"
55
edition = "2021"
66
license = "AGPL-3.0-only"
77
description = "Unofficial implemention of proton REST API in rust"
@@ -42,7 +42,7 @@ optional = true
4242
[dev-dependencies]
4343
env_logger = "0.10"
4444
tokio = {version ="1", features = ["full"]}
45-
wry = {version = "0.28"}
45+
#wry = {version = "0.28"}
4646

4747
[[example]]
4848
name = "user_id"
@@ -52,6 +52,7 @@ required-features = ["http-reqwest"]
5252
name = "user_id_sync"
5353
required-features = ["http-ureq"]
5454

55-
[[example]]
56-
name = "captcha"
57-
required-features = ["http-ureq"]
55+
#Enable wry dependency when trying this example.
56+
#[[example]]
57+
#name = "captcha"
58+
#required-features = ["http-ureq"]

src/http/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,15 @@ pub enum Error {
9595
Connection(#[source] anyhow::Error),
9696
#[error("Request/Response body error: {0}")]
9797
Request(#[source] anyhow::Error),
98+
#[error("Encoding/Decoding error: {0}")]
99+
EncodeOrDecode(#[source] anyhow::Error),
98100
#[error("Unexpected error occurred: {0}")]
99101
Other(#[source] anyhow::Error),
100102
}
101103

102104
impl From<serde_json::Error> for Error {
103105
fn from(value: serde_json::Error) -> Self {
104-
Self::Request(value.into())
106+
Self::EncodeOrDecode(value.into())
105107
}
106108
}
107109

0 commit comments

Comments
 (0)