make HTTP error an interface
1 file changed, 3 insertions(+), 6 deletions(-)
changed files
M domain/content/publisher/mux.go → domain/content/publisher/mux.go
@@ -8,22 +8,19 @@ "alin.ovh/homestead/domain/web/templates" ihttp "alin.ovh/homestead/shared/http" ) -func (app *App) Index(w http.ResponseWriter, _ *http.Request) *ihttp.Error { +func (app *App) Index(w http.ResponseWriter, _ *http.Request) ihttp.Error { err := pubtpl.IndexPage(app.siteSettings, templates.PageSettings{ Title: "Home", }).Render(w) if err != nil { - return &ihttp.Error{ - Code: http.StatusInternalServerError, - Message: "Failed to render index page", - } + return ihttp.InternalServerError("Failed to render index page", err) } return nil } -func (app *App) Style(w http.ResponseWriter, r *http.Request) *ihttp.Error { +func (app *App) Style(w http.ResponseWriter, r *http.Request) ihttp.Error { w.Header().Set("Content-Type", "text/css") http.ServeFileFS(w, r, templates.Files, "style.css")