http-rs / http-rs/http-types

http_types::Error should implement std::error::Error

Open
#88 12 comments 6 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
209
Forks
91
PR merge metrics
No merged PRs in 30d

Description

Because it doesn't, this does not compile:

```rust
async fn get(addr: &str) -> anyhow::Result {
// ...
let resp = async_h1::connect(stream, req).await?;
Ok(resp)
}
```

It's not obvious what to do, so I'm using a hack like this:

```rust
let resp = async_h1::connect(stream, req).await.map_err(anyhow::Error::msg)?;
```

In any case, all error types should implement `std::error::Error` in order to work seamlessly with the `?` operator.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.