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

add mvc.Err builtin dependency to map any context/mvc response's.Err field on methods like HandleHTTPError

relative to: https://github.com/kataras/iris/issues/1606
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-08-31 15:26:30 +03:00
parent f20e7f1ecc
commit 7f7d8df9c0
4 changed files with 37 additions and 1 deletions

View File

@@ -20,7 +20,20 @@ type (
ErrorHandlerFunc func(*context.Context, error)
// Code is a special type for status code.
// It's used for a builtin dependency to map the status code given by a previous
// method or middleware.
// Use a type like that in order to not conflict with any developer-registered
// dependencies.
// Alternatively: ctx.GetStatusCode().
Code int
// Err is a special type for error stored in mvc responses or context.
// It's used for a builtin dependency to map the error given by a previous
// method or middleware.
// Use a type like that in order to not conflict with any developer-registered
// dependencies.
// Alternatively: ctx.GetErr().
Err error
)
// HandleError fires when a non-nil error returns from a request-scoped dependency at serve-time or the handler itself.