cloudapi/v2: detach HTTPErrorHandler from Server struct

This commit is contained in:
Sanne Raymaekers 2024-06-25 12:12:10 +02:00
parent 135dd94de5
commit 39d2068d31
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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