Skip to content

Commit

Permalink
Merge #571
Browse files Browse the repository at this point in the history
571: Make the error type implement Send + Sync + 'static r=curquiza a=irevoire

# Pull Request

## Related issue
Fixes #570

## What does this PR do?
- Make the error type implement Send + Sync + 'static
- Fix the awc example since their Error type doesn’t implement Send or Sync


Co-authored-by: Tamo <[email protected]>
  • Loading branch information
meili-bors[bot] and irevoire authored Apr 16, 2024
2 parents cb32534 + 6842f92 commit 85ceec4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions examples/cli-app-with-awc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ tokio = { version = "1.27.0", features = ["full"] }
yaup = "0.2.0"
tokio-util = { version = "0.7.10", features = ["full"] }
actix-rt = "2.9.0"
anyhow = "1.0.82"
8 changes: 4 additions & 4 deletions examples/cli-app-with-awc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,23 @@ impl HttpClient for AwcClient {
.content_type(content_type)
.send_stream(stream)
.await
.map_err(|err| Error::Other(Box::new(err)))?
.map_err(|err| Error::Other(anyhow::anyhow!(err.to_string()).into()))?
} else {
request
.send()
.await
.map_err(|err| Error::Other(Box::new(err)))?
.map_err(|err| Error::Other(anyhow::anyhow!(err.to_string()).into()))?
};

let status = response.status().as_u16();
let mut body = String::from_utf8(
response
.body()
.await
.map_err(|err| Error::Other(Box::new(err)))?
.map_err(|err| Error::Other(anyhow::anyhow!(err.to_string()).into()))?
.to_vec(),
)
.map_err(|err| Error::Other(Box::new(err)))?;
.map_err(|err| Error::Other(anyhow::anyhow!(err.to_string()).into()))?;

if body.is_empty() {
body = "null".to_string();
Expand Down
2 changes: 1 addition & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub enum Error {
InvalidUuid4Version,

#[error(transparent)]
Other(Box<dyn std::error::Error>),
Other(Box<dyn std::error::Error + Send + Sync + 'static>),
}

#[derive(Debug, Clone, Deserialize, Error)]
Expand Down

0 comments on commit 85ceec4

Please sign in to comment.