1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-22 03:15:58 +00:00

omit errors received by the server via configuration 🍪 | requested by https://github.com/kataras/iris/issues/668

relative link: https://github.com/kataras/iris/issues/668


Former-commit-id: 6491abd68b74e18bf4ed0b32406e67597c9b55a9
This commit is contained in:
hiveminded
2017-07-13 16:31:36 +03:00
parent ace439203d
commit 16ccb2edc4
12 changed files with 294 additions and 64 deletions

11
iris.go
View File

@@ -33,7 +33,7 @@ import (
const (
// Version is the current version number of the Iris Web Framework.
Version = "8.0.0"
Version = "8.0.1"
)
// HTTP status codes as registered with IANA.
@@ -361,6 +361,8 @@ func (app *Application) NewHost(srv *http.Server) *host.Supervisor {
host.RegisterOnInterrupt(host.ShutdownOnInterrupt(su, shutdownTimeout))
}
su.IgnoredErrors = append(su.IgnoredErrors, app.config.IgnoreServerErrors...)
app.Hosts = append(app.Hosts, su)
return su
@@ -512,7 +514,7 @@ func (app *Application) Build() error {
// ErrServerClosed is returned by the Server's Serve, ServeTLS, ListenAndServe,
// and ListenAndServeTLS methods after a call to Shutdown or Close.
//
// Conversion for the http.ErrServerClosed.
// A shortcut for the `http#ErrServerClosed`.
var ErrServerClosed = http.ErrServerClosed
// Run builds the framework and starts the desired `Runner` with or without configuration edits.
@@ -523,7 +525,9 @@ var ErrServerClosed = http.ErrServerClosed
// then create a new host and run it manually by `go NewHost(*http.Server).Serve/ListenAndServe` etc...
// or use an already created host:
// h := NewHost(*http.Server)
// Run(Raw(h.ListenAndServe), WithCharset("UTF-8"), WithRemoteAddrHeader("CF-Connecting-IP"))
// Run(Raw(h.ListenAndServe), WithCharset("UTF-8"),
// WithRemoteAddrHeader("CF-Connecting-IP"),
// WithoutServerError(iris.ErrServerClosed))
//
// The Application can go online with any type of server or iris's host with the help of
// the following runners:
@@ -536,7 +540,6 @@ func (app *Application) Run(serve Runner, withOrWithout ...Configurator) error {
}
app.Configure(withOrWithout...)
// this will block until an error(unless supervisor's DeferFlow called from a Task).
err := serve(app)
if err != nil {