hyperium / hyperium/hyper

Clearification of Readmap wrt. Service Errors, Panics and Application Errors

Open
#1,864 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
16.3k
Forks
1.8k
Avg merge
1d 22h
Merged PRs (30d)
14

Description

Currently Service allows returning a custom error type (as long as it implements Error), but given how they are handled they make only sense for protocol level errors i.e. hyper::Error or the very view cases where you might run into it in some Service trait based protocol "extension".

But if it's just that it would make more sense to have a fixed error which implements From<> for any error which can be converted into a boxed error instead, as having a custom type kind looks like as if you can have custom error handling. Which as far as I can tell you currently can't.

Or is it planed to allow custom error handling in the future?

Currently you can work around this by wrapping a service into a service which does custom error handling.

Another problem is that currently panics cause the connection to be cut, i.e. they don't crash the whole server but aren't really handled either.

But especially servers should be more robust, in the end panics are a core part of rust, weather or not we like them or not and crashing the connections is IMHO not a solution acceptable for a system you might want to run in production at some point.

Again this can be solved by wrapping the service turning any panic into a 500 Internal Server Error (note that different use-cases have different requirements for the bodies of 500 Internal Server Error's).

Lastly even if you don't want to have any connection broken by the client in you error logs you
likely want them in the metrics, this is not something you can workaround with a service wrapper but also kinda a different requirement.

So is there a road map/plan for how panic's should be handled and custom error handling? (And having some minimal metrics about bad connections?)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Service error behavior and panic handling described in this issue, including the wrapper-based workarounds. Determine whether the project has a defined plan for custom error handling, panic responses, and connection metrics; the issue is complete only when those requirements have a decided scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.