aboutsummaryrefslogtreecommitdiffstats
path: root/src/error.rs
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2023-03-29 13:08:09 +0200
committerHarald Eilertsen <haraldei@anduin.net>2023-03-29 13:08:09 +0200
commit8100cff32bf0c87dc19fba78f3faac8090f863da (patch)
tree7c6315dbb83162b8d91aae53b920c2e7f20a4268 /src/error.rs
parenta4b9520f430ce188ba9165dcabd3320763ff2e16 (diff)
downloadrust-zotapi-8100cff32bf0c87dc19fba78f3faac8090f863da.tar.gz
rust-zotapi-8100cff32bf0c87dc19fba78f3faac8090f863da.tar.bz2
rust-zotapi-8100cff32bf0c87dc19fba78f3faac8090f863da.zip
Another reqrite...
Third time must be where it sits I hope. I felt the API was getting a bit too distracted by unnecessary constructs and abstractions, so I'm trying to simplify it by making it more straight forward. The idea now is to have one main API class (ZotApi), and all the various remote API's as public methods on this basic class. Iow, the ZotApi class is mainly based on the existing `Client` class, which is then being phased out. And instead of having each API tied to the data type they return, I'm just adding methods that will return the respective data types. This should reduce coupling between the returned data, and the API calls themselves.
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs
index 34fea2d..2954bea 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -23,6 +23,7 @@ pub enum Error {
Http(reqwest::Error),
Io(std::io::Error),
Json(serde_json::Error),
+ ParseError(url::ParseError),
Qs(serde_qs::Error),
Unauthorized,
Unknown,
@@ -46,6 +47,12 @@ impl From<serde_json::Error> for Error {
}
}
+impl From<url::ParseError> for Error {
+ fn from(e: url::ParseError) -> Error {
+ Error::ParseError(e)
+ }
+}
+
impl From<serde_qs::Error> for Error {
fn from(e: serde_qs::Error) -> Error {
Error::Qs(e)