Skip to content

Commit

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

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 22, 2024
1 parent 5a13041 commit c72d8bf
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 c72d8bf

Please sign in to comment.