1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-20 03:17:04 +00:00

Upgrade to new go errors and some minor fixes and improvements including easier debugging of invalid routes and e.t.c.

Former-commit-id: 5809157b952ccc61a67a9861470774b3a6fee024
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-10-24 18:57:05 +03:00
parent c8236a8d3e
commit 221978e41a
40 changed files with 941 additions and 834 deletions

View File

@@ -6,7 +6,7 @@ import (
"strings"
"github.com/kataras/iris/context"
"github.com/kataras/iris/core/errors"
"github.com/kataras/iris/core/errgroup"
"github.com/kataras/iris/core/netutil"
macroHandler "github.com/kataras/iris/macro/handler"
@@ -82,7 +82,7 @@ type RoutesProvider interface { // api builder
func (h *routerHandler) Build(provider RoutesProvider) error {
h.trees = h.trees[0:0] // reset, inneed when rebuilding.
rp := errors.NewReporter()
rp := errgroup.New("Routes Builder")
registeredRoutes := provider.GetRoutes()
// before sort.
@@ -138,7 +138,7 @@ func (h *routerHandler) Build(provider RoutesProvider) error {
// the docs better. Or TODO: add a link here in order to help new users.
if err := h.addRoute(r); err != nil {
// node errors:
rp.Add("%v -> %s", err, r.String())
rp.Addf("%s: %w", r.String(), err)
continue
}
}
@@ -146,7 +146,7 @@ func (h *routerHandler) Build(provider RoutesProvider) error {
golog.Debugf(r.Trace()) // keep log different parameter types in the same path as different routes.
}
return rp.Return()
return errgroup.Check(rp)
}
func bindMultiParamTypesHandler(top *Route, r *Route) {