From 0d6cd3b6112029dcad14cef12cd681d2fe9e9cad Mon Sep 17 00:00:00 2001 From: zcube Date: Sat, 9 Nov 2024 15:57:50 +0900 Subject: [PATCH] fix: add recover middleware --- cmd/local.go | 4 ++-- cmd/remote.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/local.go b/cmd/local.go index 7dd4a49..586695d 100644 --- a/cmd/local.go +++ b/cmd/local.go @@ -107,7 +107,7 @@ var localCmd = &cobra.Command{ cc, remote, rderr := conn.ReadFromUDP(b) if rderr != nil { sugar.Error("net.ReadFromUDP() error: %s", rderr) - return c.String(http.StatusInternalServerError, rderr.Error()) + return c.String(http.StatusBadGateway, rderr.Error()) } else { sugar.Debugw("Read from socket", "Bytes", cc, @@ -159,7 +159,7 @@ var localCmd = &cobra.Command{ cc, remote, rderr := conn.ReadFromUDP(b) if rderr != nil { sugar.Error("net.ReadFromUDP() error: %s", rderr) - return c.String(http.StatusInternalServerError, rderr.Error()) + return c.String(http.StatusBadGateway, rderr.Error()) } else { sugar.Debugw("Read from socket", "Bytes", cc, diff --git a/cmd/remote.go b/cmd/remote.go index 2294cfd..c8c241c 100644 --- a/cmd/remote.go +++ b/cmd/remote.go @@ -106,7 +106,7 @@ var remoteCmd = &cobra.Command{ cc, remote, rderr := conn.ReadFromUDP(b) if rderr != nil { sugar.Error("net.ReadFromUDP() error: %s", rderr) - return c.String(http.StatusInternalServerError, rderr.Error()) + return c.String(http.StatusBadGateway, rderr.Error()) } else { sugar.Debugw("Read from socket", "Bytes", cc, @@ -158,7 +158,7 @@ var remoteCmd = &cobra.Command{ cc, remote, rderr := conn.ReadFromUDP(b) if rderr != nil { sugar.Error("net.ReadFromUDP() error: %s", rderr) - return c.String(http.StatusInternalServerError, rderr.Error()) + return c.String(http.StatusBadGateway, rderr.Error()) } else { sugar.Debugw("Read from socket", "Bytes", cc,