MCPcopy Create free account
hub / github.com/kataras/iris / OnAnyErrorCode

Method OnAnyErrorCode

core/router/api_builder.go:1738–1752  ·  view source on GitHub ↗

OnAnyErrorCode registers a handlers chain for all error codes (4xxx and 5xxx, change the `context.ClientErrorCodes` and `context.ServerErrorCodes` variables to modify those) Look `UseError` and `OnErrorCode` too.

(handlers ...context.Handler)

Source from the content-addressed store, hash-verified

1736// (4xxx and 5xxx, change the `context.ClientErrorCodes` and `context.ServerErrorCodes` variables to modify those)
1737// Look `UseError` and `OnErrorCode` too.
1738func (api *APIBuilder) OnAnyErrorCode(handlers ...context.Handler) (routes []*Route) {
1739 for _, statusCode := range context.ClientAndServerErrorCodes {
1740 routes = append(routes, api.OnErrorCode(statusCode, handlers...)...)
1741 }
1742
1743 if n := len(routes); n > 1 {
1744 for _, r := range routes[1:n] {
1745 r.NoLog = true
1746 }
1747
1748 routes[0].Title = "ERR"
1749 }
1750
1751 return
1752}
1753
1754// RegisterView registers and loads a view engine middleware for this group of routes.
1755// It overrides any of the application's root registered view engines.

Callers

nothing calls this directly

Calls 1

OnErrorCodeMethod · 0.95

Tested by

no test coverage detected