Skip to content

Commit

Permalink
do not ignore error of initialization of a router
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Oct 14, 2024
1 parent d46da54 commit 9f7a13d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 9f7a13d

Please sign in to comment.