Skip to content

Commit

Permalink
Merge pull request #22 from unbekanntes-pferd:bugfix/0.10.1
Browse files Browse the repository at this point in the history
fix: panic on parsing error
  • Loading branch information
unbekanntes-pferd committed Apr 12, 2024
2 parents 008cd5f + 944f7b8 commit eb0594a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dco3"
version = "0.10.0"
version = "0.10.1"
edition = "2021"
authors = ["Octavio Simone"]
repository = "https://github.com/unbekanntes-pferd/dco3"
Expand Down
13 changes: 5 additions & 8 deletions src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@ where
E: DeserializeOwned + Into<DracoonClientError>,
{
match Into::<StatusCodeState>::into(res.status()) {
StatusCodeState::Ok(_) => Ok(res
.json::<T>()
.await
.map_err(|err| {
eprintln!("Failed to parse response body: {}", err);
error!("{}", err);
})
.expect("Correct response type")),
StatusCodeState::Ok(_) => Ok(res.json::<T>().await.map_err(|err| {
eprintln!("Failed to parse response body: {}", err);
error!("{}", err);
err
})?),
StatusCodeState::Error(_) => Err(build_error_body::<E>(res.json::<E>().await.map_err(
|err| {
error!("Failed to parse error body: {}", err);
Expand Down

0 comments on commit eb0594a

Please sign in to comment.