Verbessere Fehlerbehandlung
This commit is contained in:
parent
f04396809d
commit
0a4245b094
2 changed files with 2 additions and 4 deletions
|
@ -10,14 +10,14 @@ func (b *BaseHandler) ConfirmRequestHandler(w http.ResponseWriter, req *http.Req
|
|||
request, err := b.requestRepo.FindBySecret(secret)
|
||||
|
||||
if err != nil {
|
||||
// TODO: header 404
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
templating.ServeTemplate(w, "requestNotFound", nil)
|
||||
return
|
||||
}
|
||||
|
||||
err = b.requestRepo.Execute(request)
|
||||
if err != nil {
|
||||
// TODO: write header 500
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
templating.ServeTemplate(w, "executeFailure", err.Error())
|
||||
return
|
||||
}
|
||||
|
|
2
main.go
2
main.go
|
@ -42,13 +42,11 @@ func main() {
|
|||
// parse templates
|
||||
if err = templating.InitTemplates(); err != nil {
|
||||
log.Print(err.Error())
|
||||
log.Fatal(">>>\nFatal error occurred, aborting program\n<<<\n")
|
||||
}
|
||||
// database connection
|
||||
db, err := sqldb.Connect(conf)
|
||||
if err != nil {
|
||||
log.Print(err.Error())
|
||||
log.Fatal(">>>\nFatal error occurred, aborting program\n<<<\n")
|
||||
}
|
||||
// Create repos
|
||||
roomRepo := repositories.NewRoomRepo(db)
|
||||
|
|
Loading…
Reference in a new issue