From 9f7a13dcf3a59247bea684a14febecfbc4396c45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wilson=20J=C3=BAnior?= Date: Mon, 14 Oct 2024 13:53:47 -0300 Subject: [PATCH] do not ignore error of initialization of a router --- api/api.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/api/api.go b/api/api.go index a96cc29..cc22329 100644 --- a/api/api.go +++ b/api/api.go @@ -74,9 +74,14 @@ func (a *RouterAPI) registerRoutes(r *mux.Router) { func (a *RouterAPI) router(ctx context.Context, mode string, header http.Header) (router.Router, error) { router, err := a.Backend.Router(ctx, mode, header) - if err == backend.ErrBackendNotFound { - return nil, httpError{Status: http.StatusNotFound} + if err != nil { + if err == backend.ErrBackendNotFound { + return nil, httpError{Status: http.StatusNotFound} + } + + return nil, err } + return router, nil }