http-rs / http-rs/async-h1

Error handling

Open
#130 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
166
Forks
49
PR merge metrics
No merged PRs in 30d

Description

An `Error` always has an associated `StatusCode`. From this, I assumed that errors are converted into HTTP responses when using the `accept` function.

However, that does not seem to be the case. The errors are just propagated, which results in a connection closing without a response:

https://github.com/http-rs/async-h1/blob/5606a9d85f069f12b66120fc4bbfe065a8ad6155/src/server/mod.rs#L75

Should this be handled automatically by `accept`, or is this the job of the user? If the latter, then what is the advantage of the `StatusCode` requirement for errors?

Contributor guide

Open the contributing guide

Research direction

Start by reading src/server/mod.rs around line 75 and trace how accept handles propagated errors and their StatusCode. Determine whether errors should become HTTP responses automatically or remain the user's responsibility; done means resolving that behavior and documenting the expected handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.