From ba7e62f3c5dc297173b8cc8f18280cca28d5e9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Lewandowski?= Date: Thu, 22 Feb 2024 15:14:11 +0100 Subject: [PATCH] chore(BUX-223): refactor ErrorResponse --- server/error.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/server/error.go b/server/error.go index 9fc98f2..963a98b 100644 --- a/server/error.go +++ b/server/error.go @@ -1,11 +1,9 @@ package server import ( - "encoding/json" "errors" "github.com/bitcoin-sv/go-paymail" "github.com/gin-gonic/gin" - "net/http" ) // Error codes for server response errors @@ -60,12 +58,5 @@ var ( // Specs: http://bsvalias.org/99-01-recommendations.html func ErrorResponse(c *gin.Context, code, message string, statusCode int) { srvErr := &paymail.ServerError{Code: code, Message: message} - jsonData, err := json.Marshal(srvErr) - - if err != nil { - c.JSON(http.StatusInternalServerError, ErrorFailedMarshalJSON) - return - } - - c.JSON(statusCode, jsonData) + c.JSON(statusCode, srvErr) }