blob: 377ad4cf28c90a188fe73ceed68a16230fcd44d0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
// SPDX-License-Identifier: AGPL-3.0-only
// SPDX-FileContributor: Runxi Yu <https://runxiyu.org>
package main
import "net/http"
// render_template abstracts out the annoyances of reporting template rendering
// errors.
func render_template(w http.ResponseWriter, template_name string, params map[string]any) {
if err := templates.ExecuteTemplate(w, template_name, params); err != nil {
http.Error(w, "Error rendering template: "+err.Error(), http.StatusInternalServerError)
}
}
|