From 3af05971b6ea42be99dc2dfc3e78c8019f9a6a9c Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sat, 1 May 2021 09:45:45 +0700 Subject: [PATCH] improve documentation of errors for Session and Stream --- interface.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/interface.go b/interface.go index 56b90e04c..00e2e0a95 100644 --- a/interface.go +++ b/interface.go @@ -79,6 +79,8 @@ var SessionTracingKey = sessionTracingCtxKey{} type sessionTracingCtxKey struct{} // Stream is the interface implemented by QUIC streams +// In addition to the errors listed on the Session, +// calls to stream functions can return a StreamError if the stream is canceled. type Stream interface { ReceiveStream SendStream @@ -148,6 +150,13 @@ type SendStream interface { } // A Session is a QUIC connection between two peers. +// Calls to the session (and to streams) can return the following types of errors: +// * ApplicationError: for errors triggered by the application running on top of QUIC +// * TransportError: for errors triggered by the QUIC transport (in many cases a misbehaving peer) +// * IdleTimeoutError: when the peer goes away unexpectedly (this is a net.Error timeout error) +// * HandshakeTimeoutError: when the cryptographic handshake takes too long (this is a net.Error timeout error) +// * StatelessResetError: when we receive a stateless reset (this is a net.Error temporary error) +// * VersionNegotiationError: returned by the client, when there's no version overlap between the peers type Session interface { // AcceptStream returns the next stream opened by the peer, blocking until one is available. // If the session was closed due to a timeout, the error satisfies