Verbessere Fehlerbehandlung
This commit is contained in:
parent
f04396809d
commit
9357ab1520
2 changed files with 5 additions and 7 deletions
8
main.go
8
main.go
|
@ -41,14 +41,12 @@ func main() {
|
|||
staticHandler := http.FileServer(http.Dir("./static"))
|
||||
// parse templates
|
||||
if err = templating.InitTemplates(); err != nil {
|
||||
log.Print(err.Error())
|
||||
log.Fatal(">>>\nFatal error occurred, aborting program\n<<<\n")
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
// database connection
|
||||
db, err := sqldb.Connect(conf)
|
||||
if err != nil {
|
||||
log.Print(err.Error())
|
||||
log.Fatal(">>>\nFatal error occurred, aborting program\n<<<\n")
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
// Create repos
|
||||
roomRepo := repositories.NewRoomRepo(db)
|
||||
|
@ -67,5 +65,5 @@ func main() {
|
|||
http.Handle("/static/", http.StripPrefix("/static/", staticHandler))
|
||||
|
||||
err = http.ListenAndServe(fmt.Sprintf("%s:%d", conf.Server.ListenAddress, conf.Server.ListenPort), nil)
|
||||
log.Println(err.Error())
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue