Verbessere Logging und Fehlerbehandlung
This commit is contained in:
parent
c737818ce4
commit
6e97d867de
14 changed files with 223 additions and 88 deletions
12
main.go
12
main.go
|
@ -7,11 +7,11 @@ import (
|
|||
"log"
|
||||
"log/syslog"
|
||||
"net/http"
|
||||
"os"
|
||||
"officeHours/config"
|
||||
"officeHours/controllers"
|
||||
"officeHours/repositories"
|
||||
"officeHours/sqldb"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -19,6 +19,11 @@ func main() {
|
|||
if e == nil {
|
||||
log.SetOutput(logwriter)
|
||||
}
|
||||
|
||||
if controllers.TemplateError != nil {
|
||||
log.Fatalf("Error parsing templates: %s", controllers.TemplateError.Error())
|
||||
}
|
||||
|
||||
configFile := flag.String(
|
||||
"config",
|
||||
"config/config.json",
|
||||
|
@ -35,7 +40,10 @@ func main() {
|
|||
log.Fatalf("%s: %s", "Reading JSON config file into config structure", err)
|
||||
}
|
||||
|
||||
db := sqldb.Connect(conf)
|
||||
db, err := sqldb.Connect(conf)
|
||||
if err != nil {
|
||||
log.Fatalf(err.Error())
|
||||
}
|
||||
// Create repos
|
||||
roomRepo := repositories.NewRoomRepo(db)
|
||||
courseRepo := repositories.NewCourseRepo(db)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue