impl From reqwest::Error for ChorusError
This commit is contained in:
parent
5f41f57e77
commit
99155d1e5b
|
@ -1,5 +1,6 @@
|
||||||
//! Contains all the errors that can be returned by the library.
|
//! Contains all the errors that can be returned by the library.
|
||||||
use custom_error::custom_error;
|
use custom_error::custom_error;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
use crate::types::WebSocketEvent;
|
use crate::types::WebSocketEvent;
|
||||||
|
|
||||||
|
@ -44,6 +45,18 @@ custom_error! {
|
||||||
InvalidArguments{error: String} = "Invalid arguments were provided. Error: {error}"
|
InvalidArguments{error: String} = "Invalid arguments were provided. Error: {error}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<reqwest::Error> for ChorusError {
|
||||||
|
fn from(value: reqwest::Error) -> Self {
|
||||||
|
ChorusError::RequestFailed {
|
||||||
|
url: match value.url() {
|
||||||
|
Some(url) => url.to_string(),
|
||||||
|
None => "None".to_string(),
|
||||||
|
},
|
||||||
|
error: value.to_string(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
custom_error! {
|
custom_error! {
|
||||||
#[derive(PartialEq, Eq)]
|
#[derive(PartialEq, Eq)]
|
||||||
pub ObserverError
|
pub ObserverError
|
||||||
|
|
Loading…
Reference in New Issue