From 39d2068d3173901eda8e38357deb9ecc4e26a680 Mon Sep 17 00:00:00 2001 From: Sanne Raymaekers Date: Tue, 25 Jun 2024 12:12:10 +0200 Subject: [PATCH] cloudapi/v2: detach HTTPErrorHandler from Server struct --- internal/cloudapi/v2/errors.go | 2 +- internal/cloudapi/v2/server.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/cloudapi/v2/errors.go b/internal/cloudapi/v2/errors.go index 61280ffb1..af74377b6 100644 --- a/internal/cloudapi/v2/errors.go +++ b/internal/cloudapi/v2/errors.go @@ -275,7 +275,7 @@ func apiErrorFromEchoError(echoError *echo.HTTPError) ServiceErrorCode { } // Convert an echo error into an AOC compliant one so we send a correct json error response -func (s *Server) HTTPErrorHandler(echoError error, c echo.Context) { +func HTTPErrorHandler(echoError error, c echo.Context) { doResponse := func(details interface{}, code ServiceErrorCode, c echo.Context, internal error) { if !c.Response().Committed { var err error diff --git a/internal/cloudapi/v2/server.go b/internal/cloudapi/v2/server.go index ac56719da..c3ea6887b 100644 --- a/internal/cloudapi/v2/server.go +++ b/internal/cloudapi/v2/server.go @@ -86,7 +86,7 @@ func NewServer(workers *worker.Server, distros *distrofactory.Factory, repos *re func (s *Server) Handler(path string) http.Handler { e := echo.New() e.Binder = binder{} - e.HTTPErrorHandler = s.HTTPErrorHandler + e.HTTPErrorHandler = HTTPErrorHandler e.Logger = common.Logger() // OperationIDMiddleware - generates OperationID random string and puts it into the contexts