1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 10:27:06 +00:00

error handlers per party: log those routes too and all test cases paased

need cleanup though


Former-commit-id: 6b0c18e38b58af2388015c7cf1af9cc43d7d35d3
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-05-11 11:11:27 +03:00
parent c039730521
commit ad74d7b935
6 changed files with 71 additions and 44 deletions

View File

@@ -216,7 +216,7 @@ func (h *routerHandler) Build(provider RoutesProvider) error {
routes []*Route
}
allMethods := append(AllMethods, MethodNone)
allMethods := append(AllMethods, []string{MethodNone, ""}...)
methodRoutes := make([]MethodRoutes, 0, len(allMethods))
for _, method := range allMethods {
@@ -246,6 +246,9 @@ func (h *routerHandler) Build(provider RoutesProvider) error {
fmt.Fprint(logger.Printer, ", ")
}
}
if m.method == "" {
m.method = "ERROR"
}
fmt.Fprintf(logger.Printer, "%d ", len(m.routes))
pio.WriteRich(logger.Printer, m.method, traceMethodColor(m.method))
}
@@ -459,6 +462,16 @@ func (h *routerHandler) FireErrorCode(ctx context.Context) {
}
if n != nil {
// Note: handlers can contain macro filters here,
// they are registered as error handlers, see macro/handler.go#42.
// fmt.Println("Error Handlers")
// for _, h := range n.Handlers {
// f, l := context.HandlerFileLine(h)
// fmt.Printf("%s: %s:%d\n", ctx.Path(), f, l)
// }
// fire this http status code's error handlers chain.
// ctx.StopExecution() // not uncomment this, is here to remember why to.