OnErrorCode registers a handlers chain for this `Party` for a specific HTTP status code. Read more at: http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml Look `UseError` and `OnAnyErrorCode` too.
(statusCode int, handlers ...context.Handler)
| 1723 | // Read more at: http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml |
| 1724 | // Look `UseError` and `OnAnyErrorCode` too. |
| 1725 | func (api *APIBuilder) OnErrorCode(statusCode int, handlers ...context.Handler) (routes []*Route) { |
| 1726 | routes = append(routes, api.handle(statusCode, "", "/", handlers...)) |
| 1727 | |
| 1728 | if api.relativePath != "/" { |
| 1729 | routes = append(routes, api.handle(statusCode, "", "/{tail:path}", handlers...)) |
| 1730 | } |
| 1731 | |
| 1732 | return |
| 1733 | } |
| 1734 | |
| 1735 | // OnAnyErrorCode registers a handlers chain for all error codes |
| 1736 | // (4xxx and 5xxx, change the `context.ClientErrorCodes` and `context.ServerErrorCodes` variables to modify those) |