WithoutServerError will cause to ignore the matched "errors" from the main application's `Run/Listen` function. Usage: err := app.Listen(":8080", iris.WithoutServerError(iris.ErrServerClosed)) will return `nil` if the server's error was `http/iris#ErrServerClosed`. See `Configuration#IgnoreServerE
(errors ...error)
| 234 | // |
| 235 | // Example: https://github.com/kataras/iris/tree/main/_examples/http-server/listen-addr/omit-server-errors |
| 236 | func WithoutServerError(errors ...error) Configurator { |
| 237 | return func(app *Application) { |
| 238 | if len(errors) == 0 { |
| 239 | return |
| 240 | } |
| 241 | |
| 242 | errorsAsString := make([]string, len(errors)) |
| 243 | for i, e := range errors { |
| 244 | errorsAsString[i] = e.Error() |
| 245 | } |
| 246 | |
| 247 | app.config.IgnoreServerErrors = append(app.config.IgnoreServerErrors, errorsAsString...) |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | // WithoutStartupLog turns off the information send, once, to the terminal when the main server is open. |
| 252 | var WithoutStartupLog = func(app *Application) { |