http-rs / http-rs/surf

surf::Exception does not implement std::error::Error

Open
#86 17 comments 25 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.5k
Forks
128
PR merge metrics
No merged PRs in 30d

Description

This is an unfriendly choice for errors returned by a library because it makes them not work with `?`.

```rust
async fn repro() -> Result<(), failure::Error> {
let _ = surf::get("https://www.rust-lang.org").await?; // doesn't work
Ok(())
}
```

```rust
async fn repro() -> anyhow::Result<()> {
let _ = surf::get("https://www.rust-lang.org").await?; // doesn't work
Ok(())
}
```

Application-focused error types like failure::Error are built on `impl From` which is why it matters that library errors implement std::error::Error.

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.