error.go 425 B

123456789101112131415161718
  1. package routes
  2. import (
  3. "log"
  4. "net/http"
  5. "codeberg.org/vnpower/pixivfe/v2/request_context"
  6. "codeberg.org/vnpower/pixivfe/v2/template"
  7. )
  8. func ErrorPage(w http.ResponseWriter, r *http.Request, err error, statusCode int) {
  9. request_context.Get(r).RenderStatusCode = statusCode
  10. err = template.Render(w, r, Data_error{Title: "Error", Error: err})
  11. if err != nil {
  12. log.Printf("Error rendering error route: %s", err)
  13. }
  14. }