diff options
| -rw-r--r-- | internal/types/types.go | 10 |
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 } } |
