From 15cd6fa1fc52f88b58283a673c134a97bea275d3 Mon Sep 17 00:00:00 2001 From: yinheli Date: Tue, 23 Jul 2024 21:24:41 +0800 Subject: [PATCH] docs(service): add note about error handling in Service trait (#3659) (#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. --- src/service/service.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/service/service.rs b/src/service/service.rs index 1b9aea5162..44d945ebb0 100644 --- a/src/service/service.rs +++ b/src/service/service.rs @@ -22,6 +22,11 @@ pub trait Service { 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.