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

Method OnErrorCode

core/router/api_builder.go:1725–1733  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1723// Read more at: http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
1724// Look `UseError` and `OnAnyErrorCode` too.
1725func (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)

Callers 1

OnAnyErrorCodeMethod · 0.95

Calls 1

handleMethod · 0.95

Tested by

no test coverage detected