Skip to content

Commit

Permalink
doc(service): add note about error handling in Service trait (#3659)
Browse files Browse the repository at this point in the history
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 committed Jul 23, 2024
1 parent 5a13041 commit 6c1c92a
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

0 comments on commit 6c1c92a

Please sign in to comment.