From d8153df67f67e059a4def62c3904298b870e95db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Wed, 5 Feb 2025 09:47:22 +0800 Subject: [PATCH] Add ENOTCONN to IsClosed --- common/exceptions/error.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/exceptions/error.go b/common/exceptions/error.go index 3f08ac4..0f33792 100644 --- a/common/exceptions/error.go +++ b/common/exceptions/error.go @@ -40,11 +40,11 @@ func Extend(cause error, message ...any) error { } func IsClosedOrCanceled(err error) bool { - return IsMulti(err, io.EOF, net.ErrClosed, io.ErrClosedPipe, os.ErrClosed, syscall.EPIPE, syscall.ECONNRESET, context.Canceled, context.DeadlineExceeded) || IsTimeout(err) + return IsClosed(err) || IsCanceled(err) || IsTimeout(err) } func IsClosed(err error) bool { - return IsMulti(err, io.EOF, net.ErrClosed, io.ErrClosedPipe, os.ErrClosed, syscall.EPIPE, syscall.ECONNRESET) + return IsMulti(err, io.EOF, net.ErrClosed, io.ErrClosedPipe, os.ErrClosed, syscall.EPIPE, syscall.ECONNRESET, syscall.ENOTCONN) } func IsCanceled(err error) bool {