Compare commits

..

3 Commits

Author SHA1 Message Date
Gwen Lg
5cce702f03 wip: improve error management with thiserror 2024-06-13 23:03:18 +02:00
Gwen Lg
f1b5c7d4f8 add thiserror dependency 2024-06-13 23:01:43 +02:00
Gwen Lg
c4ad9973ef cargo update 2024-06-13 23:01:30 +02:00
3 changed files with 495 additions and 957 deletions

1439
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -14,10 +14,10 @@ categories = ["text-processing"]
[dependencies]
serde_json = "1.0.96"
reqwest = { version = "0.12.4", features = ["json"] }
reqwest = { version = "0.11.18", features = ["json"] }
serde = { version = "1.0.163", features = ["derive"] }
log = "0.4.17"
zip = { version = "2.1.3", optional = true }
zip = { version = "0.6.3", optional = true }
mktemp = { version = "0.5.0", optional = true }
rand = { version = "0.8.5", optional = true }
port_scanner = {version = "0.1.5", optional = true}
@ -27,5 +27,5 @@ thiserror = "1.0.61"
embedded-server = ["zip", "mktemp", "rand", "port_scanner"]
[dev-dependencies]
env_logger = "0.11.3"
env_logger = "0.10.0"
tokio = { version = "1.28.1", features = ["full"] }

View File

@ -305,7 +305,6 @@ pub struct SuggestResult {
#[derive(Debug, Error)]
pub enum Error {
#[cfg(feature = "embedded-server")]
#[error("Grammalecte-server failed to start")]
ServerStartFailed(#[from] server::Error),
@ -411,7 +410,7 @@ impl GrammalecteClient {
let mut params = HashMap::new();
params.insert("token", token);
reqwest::Client::new()
Ok(reqwest::Client::new()
.post(&url)
.form(&params)
.send()
@ -419,7 +418,7 @@ impl GrammalecteClient {
.map_err(Error::RequestSendSuggest)?
.json()
.await
.map_err(Error::SuggestDeserialize)
.map_err(Error::SuggestDeserialize)?)
}
}