summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordemo <demo@antix1>2026-05-07 16:53:20 -0400
committerdemo <demo@antix1>2026-05-07 16:53:20 -0400
commite23c98bb4e751ea4d609ce6f6fac2fdac9060e8a (patch)
treed6ff6f35c045f84ae66de91444b63d687aae4d2f
parentc2421cb225e7976cb406cb20ae87c7c9c1c8f43b (diff)
feat: touch up http-error reporting and loggingHEADmain
-rw-r--r--internal/types/types.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/internal/types/types.go b/internal/types/types.go
index b431eaf..4f70ed7 100644
--- a/internal/types/types.go
+++ b/internal/types/types.go
@@ -1,8 +1,8 @@
package types
import (
- "fmt"
"html/template"
+ "log"
"net/http"
)
@@ -28,13 +28,15 @@ func (cfg Config) ServeHTTP(w http.ResponseWriter, r *http.Request) {
arcName := r.PathValue("arc")
arc, ok := cfg.Story[arcName]
if !ok {
- msg := fmt.Sprintf("Arc with name %s doesn't exist", arcName)
- http.Error(w, msg, http.StatusNotFound)
+ log.Printf("Arc with name %s doesn't exist", arcName)
+ http.Error(w, "Page not found", http.StatusNotFound)
return
}
w.Header().Set("Content-Type", "text/html")
if err := cfg.ExecuteTemplate(w, "index", arc); err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
+ log.Print(err)
+ http.Error(w, "Something went wrong!", http.StatusInternalServerError)
+ return
}
}