1
0
mirror of https://github.com/kataras/iris.git synced 2026-03-06 00:16:12 +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

@@ -33,6 +33,22 @@ type Party interface {
// Learn more at: https://github.com/kataras/iris/tree/master/_examples/routing/dynamic-path
Macros() *macro.Macros
// OnErrorCode registers an error http status code
// based on the "statusCode" < 200 || >= 400 (came from `context.StatusCodeNotSuccessful`).
// The handler is being wrapped by a generic
// handler which will try to reset
// the body if recorder was enabled
// and/or disable the gzip if gzip response recorder
// was active.
OnErrorCode(statusCode int, handlers ...context.Handler)
// OnAnyErrorCode registers a handler which called when error status code written.
// Same as `OnErrorCode` but registers all http error codes based on the `context.StatusCodeNotSuccessful`
// which defaults to < 200 || >= 400 for an error code, any previous error code will be overridden,
// so call it first if you want to use any custom handler for a specific error status code.
//
// Read more at: http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
OnAnyErrorCode(handlers ...context.Handler)
// Party groups routes which may have the same prefix and share same handlers,
// returns that new rich subrouter.
//