This repository was archived by the owner on Jul 6, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +15
-14
lines changed Expand file tree Collapse file tree 3 files changed +15
-14
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " proton-api-rs"
3
3
authors = [" Leander Beernaert <lbb-dev@pm.me>" ]
4
- version = " 0.5.0 "
4
+ version = " 0.5.1 "
5
5
edition = " 2021"
6
6
license = " AGPL-3.0-only"
7
7
description = " Unofficial implemention of proton REST API in rust"
Original file line number Diff line number Diff line change @@ -17,16 +17,16 @@ pub enum RequestError {
17
17
#[ derive( Debug , Error ) ]
18
18
/// Errors that may occur during an HTTP request, mostly related to network.
19
19
pub enum HttpClientError {
20
- #[ error( "A redirect error occurred at '{0}" ) ]
21
- Redirect ( String ) ,
20
+ #[ error( "A redirect error occurred at '{0}: {1} " ) ]
21
+ Redirect ( String , # [ source ] anyhow :: Error ) ,
22
22
#[ error( "Connection timed out" ) ]
23
- Timeout ,
24
- #[ error( "Connection error occurred " ) ]
25
- Connection ,
26
- #[ error( "An error occurred related to either the request or response body " ) ]
27
- Body ,
28
- #[ error( "An error occurred preparing the request " ) ]
29
- Request ,
23
+ Timeout ( # [ source ] anyhow :: Error ) ,
24
+ #[ error( "Connection error: {0} " ) ]
25
+ Connection ( # [ source ] anyhow :: Error ) ,
26
+ #[ error( "Request/Response body error: {0} " ) ]
27
+ Body ( # [ source ] anyhow :: Error ) ,
28
+ #[ error( "Request error:{0} " ) ]
29
+ Request ( # [ source ] anyhow :: Error ) ,
30
30
#[ error( "Unexpected error occurred: {0}" ) ]
31
31
Other ( #[ source] anyhow:: Error ) ,
32
32
}
Original file line number Diff line number Diff line change @@ -167,22 +167,23 @@ impl From<reqwest::Error> for HttpClientError {
167
167
fn from ( value : reqwest:: Error ) -> Self {
168
168
#[ cfg( not( target_arch = "wasm32" ) ) ]
169
169
if value. is_connect ( ) {
170
- return HttpClientError :: Connection ;
170
+ return HttpClientError :: Connection ( anyhow :: Error :: new ( value ) ) ;
171
171
}
172
172
173
173
if value. is_body ( ) {
174
- HttpClientError :: Body
174
+ HttpClientError :: Body ( anyhow :: Error :: new ( value ) )
175
175
} else if value. is_redirect ( ) {
176
176
HttpClientError :: Redirect (
177
177
value
178
178
. url ( )
179
179
. map ( |v| v. to_string ( ) )
180
180
. unwrap_or ( "Unknown URL" . to_string ( ) ) ,
181
+ anyhow:: Error :: new ( value) ,
181
182
)
182
183
} else if value. is_timeout ( ) {
183
- HttpClientError :: Timeout
184
+ HttpClientError :: Timeout ( anyhow :: Error :: new ( value ) )
184
185
} else if value. is_request ( ) {
185
- HttpClientError :: Request
186
+ HttpClientError :: Request ( anyhow :: Error :: new ( value ) )
186
187
} else {
187
188
HttpClientError :: Other ( anyhow:: Error :: new ( value) )
188
189
}
You can’t perform that action at this time.
0 commit comments