cloudapi/v2: detach HTTPErrorHandler from Server struct
This commit is contained in:
parent
135dd94de5
commit
39d2068d31
2 changed files with 2 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue