Skip to content

Commit caec9cf

Browse files
konfortesaldas
authored andcommitted
Update Echo#Start error handling
When encountering an error on app start, `bind: address already in use` for example, the app won't quit and keep waiting on the exit channel for a signal. Therefore, Logger.Info changed to Logger.Fatal . In order to not quit immediately on SIGINT another condition added: err != http.ErrServerClosed
1 parent b06a235 commit caec9cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cookbook/graceful-shutdown/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ func main() {
2222

2323
// Start server
2424
go func() {
25-
if err := e.Start(":1323"); err != nil {
26-
e.Logger.Info("shutting down the server")
25+
if err := e.Start(":1323"); err != nil && err != http.ErrServerClosed {
26+
e.Logger.Fatal("shutting down the server")
2727
}
2828
}()
2929

0 commit comments

Comments
 (0)