aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2023-03-26 15:26:57 +0200
committerHarald Eilertsen <haraldei@anduin.net>2023-03-26 15:26:57 +0200
commit4582390ca55ce440f365d1de19a5971f27d48a9b (patch)
tree2941a0f4f313c33f448b65434bea9c8ea5e0e024
parent3cc87b45f70ae32fe8ca69b3cd185dd8d56d94dd (diff)
downloadrust-zotapi-4582390ca55ce440f365d1de19a5971f27d48a9b.tar.gz
rust-zotapi-4582390ca55ce440f365d1de19a5971f27d48a9b.tar.bz2
rust-zotapi-4582390ca55ce440f365d1de19a5971f27d48a9b.zip
Add generix API error which is a string.
-rw-r--r--src/error.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs
index 9559ae6..34fea2d 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -19,6 +19,7 @@ use std;
#[derive(Debug)]
pub enum Error {
+ APIError(String),
Http(reqwest::Error),
Io(std::io::Error),
Json(serde_json::Error),
@@ -50,3 +51,9 @@ impl From<serde_qs::Error> for Error {
Error::Qs(e)
}
}
+
+impl From<&str> for Error {
+ fn from(msg: &str) -> Error {
+ Error::APIError(msg.to_string())
+ }
+}