From 57bc655468ffc78415a049037f72fce8cafbbd9c Mon Sep 17 00:00:00 2001 From: Mostafa Moradian Date: Sun, 8 Oct 2023 19:41:54 +0200 Subject: [PATCH] Fix nil error and wrap the error --- network/proxy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/network/proxy.go b/network/proxy.go index 04db6dd9..66bf065d 100644 --- a/network/proxy.go +++ b/network/proxy.go @@ -307,10 +307,10 @@ func (pr *Proxy) PassThroughToServer(conn net.Conn) *gerr.GatewayDError { } span.AddEvent("Ran the OnTrafficFromClient hooks") - if errors.Is(origErr, io.EOF) { + if origErr != nil && errors.Is(origErr, io.EOF) { // Client closed the connection. span.AddEvent("Client closed the connection") - return gerr.ErrClientNotConnected + return gerr.ErrClientNotConnected.Wrap(origErr) } // If the hook wants to terminate the connection, do it.