Show error when ListenAndServe fails

and exit with 1
pull/24/head
Matt Baer 6 years ago
parent 59f436052e
commit ae019e4dc3
  1. 6
      app.go

@ -249,7 +249,11 @@ func Serve() {
http.Handle("/", r)
log.Info("Serving on http://localhost:%d\n", app.cfg.Server.Port)
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) {

Loading…
Cancel
Save