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)
| 1736 | // (4xxx and 5xxx, change the `context.ClientErrorCodes` and `context.ServerErrorCodes` variables to modify those) |
| 1737 | // Look `UseError` and `OnErrorCode` too. |
| 1738 | func (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. |
nothing calls this directly
no test coverage detected