1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 02:17:05 +00:00

HTTP error handlers per Party (docs and details in progress)

Former-commit-id: 7092ebed556b56d9f1769b9b23f2340c2a3a18f7
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-05-11 00:44:54 +03:00
parent 3657aaf240
commit c039730521
18 changed files with 434 additions and 306 deletions

View File

@@ -13,7 +13,8 @@ import (
- Build should builds the handler, it's being called on router's BuildRouter.
Build(provider router.RoutesProvider) error
- RouteExists reports whether a particular route exists.
RouteExists(ctx iris.Context, method, path string) bool
RouteExists(ctx iris.Context, method, path string) bool
- FireErrorCode(ctx context.Context) should handle the given ctx.GetStatusCode().
For a more detailed, complete and useful example
you can take a look at the iris' router itself which is located at:
@@ -44,7 +45,7 @@ func (r *customRouter) HandleRequest(ctx iris.Context) {
}
}
ctx.SetCurrentRouteName(route.Name)
ctx.SetCurrentRoute(route.ReadOnly)
ctx.Do(route.Handlers)
return
}
@@ -71,6 +72,11 @@ func (r *customRouter) RouteExists(ctx iris.Context, method, path string) bool {
return false
}
func (r *customRouter) FireErrorCode(ctx iris.Context) {
// responseStatusCode := ctx.GetStatusCode() // set by prior ctx.StatusCode calls
// [...]
}
func main() {
app := iris.New()