Skip to content

Commit

Permalink
docs(service): add note about error handling in Service trait (#3659) (
Browse files Browse the repository at this point in the history
…#3712)

The Service trait now includes a note about the behavior of returning an Error to a hyper server, which can cause the connection to be abruptly aborted depending on the protocol. This information is important for developers working with hyper servers.
  • Loading branch information
yinheli authored Jul 23, 2024
1 parent 5a13041 commit 15cd6fa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/service/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ pub trait Service<Request> {
type Response;

/// Errors produced by the service.
///
/// Note: Returning an `Error` to a hyper server, the behavior depends on the
/// protocol. In most cases, hyper will cause the connection to be abruptly aborted.
/// It will abort the request however the protocol allows, either with some sort of RST_STREAM,
/// or killing the connection if that doesn't exist.
type Error;

/// The future response value.
Expand Down

1 comment on commit 15cd6fa

@LordMoMA
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this change merged?

Please sign in to comment.