Skip to content

Commit 802edcc

Browse files
committed
exceptions: classify QUIC StreamError as canceled
1 parent 8874f10 commit 802edcc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

common/exceptions/error.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net"
88
"net/http"
99
"os"
10+
"strings"
1011
"syscall"
1112
_ "unsafe"
1213

@@ -65,5 +66,14 @@ func IsClosed(err error) bool {
6566
}
6667

6768
func IsCanceled(err error) bool {
68-
return IsMulti(err, context.Canceled, context.DeadlineExceeded)
69+
return IsMulti(err, context.Canceled, context.DeadlineExceeded) || isCanceledQuicLike(err)
70+
}
71+
72+
func isCanceledQuicLike(err error) bool {
73+
if err == nil {
74+
return false
75+
}
76+
s := err.Error()
77+
return strings.Contains(s, "canceled by remote with error code 0") ||
78+
strings.Contains(s, "canceled by local with error code 0")
6979
}

0 commit comments

Comments
 (0)