async-h1 icon indicating copy to clipboard operation
async-h1 copied to clipboard

Error handling

Open dbrgn opened this issue 5 years ago • 0 comments

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?

dbrgn avatar Jul 28 '20 16:07 dbrgn