Show error when ListenAndServe fails
and exit with 1
This commit is contained in:
6
app.go
6
app.go
@@ -249,7 +249,11 @@ func Serve() {
|
|||||||
http.Handle("/", r)
|
http.Handle("/", r)
|
||||||
log.Info("Serving on http://localhost:%d\n", app.cfg.Server.Port)
|
log.Info("Serving on http://localhost:%d\n", app.cfg.Server.Port)
|
||||||
log.Info("---")
|
log.Info("---")
|
||||||
http.ListenAndServe(fmt.Sprintf(":%d", app.cfg.Server.Port), nil)
|
err = http.ListenAndServe(fmt.Sprintf(":%d", app.cfg.Server.Port), nil)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Unable to start: %v", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func connectToDatabase(app *app) {
|
func connectToDatabase(app *app) {
|
||||||
|
Reference in New Issue
Block a user