Skip to content

Commit

Permalink
[FIX] Use Error()
Browse files Browse the repository at this point in the history
  • Loading branch information
Plaenkler committed Sep 30, 2024
1 parent 31b1760 commit 5010a39
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/server/routes/web/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ func ProvideIndex(w http.ResponseWriter, r *http.Request) {
addr, err := ddns.GetPublicIP()
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprintf(w, "could not get public IP address: %s", err)
fmt.Fprintf(w, "could not get public IP address: %s", err.Error())
return
}
img, err := totps.GetKeyAsQR()
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprintf(w, "could not generate TOTP QR code: %s", err)
fmt.Fprintf(w, "could not generate TOTP QR code: %s", err.Error())
return
}
data := indexPageData{
Expand All @@ -61,13 +61,13 @@ func ProvideIndex(w http.ResponseWriter, r *http.Request) {
err = db.Find(&data.Jobs).Error
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprintf(w, "could not find jobs: %s", err)
fmt.Fprintf(w, "could not find jobs: %s", err.Error())
return
}
err = sanitizeParams(data.Jobs)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprintf(w, "formatting params failed: %s", err)
fmt.Fprintf(w, "formatting params failed: %s", err.Error())
return
}
tpl, err := template.New("index").Funcs(template.FuncMap{
Expand All @@ -80,14 +80,14 @@ func ProvideIndex(w http.ResponseWriter, r *http.Request) {
)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprintf(w, "could not provide template: %s", err)
fmt.Fprintf(w, "could not provide template: %s", err.Error())
return
}
w.Header().Add("Content-Type", "text/html")
err = tpl.Execute(w, data)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprintf(w, "could not execute parsed template: %v", err)
fmt.Fprintf(w, "could not execute parsed template: %v", err.Error())
}
}

Expand Down

0 comments on commit 5010a39

Please sign in to comment.