31 lines
604 B
Go
31 lines
604 B
Go
|
package templates
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
func (T Templates) internalTemplateErrorSplash(w http.ResponseWriter, r *http.Request, e ErrorSplain) {
|
||
|
w.Header().Set("Content-Type", "text/html")
|
||
|
w.WriteHeader(e.Status)
|
||
|
// w.WriteHeader(http.StatusInternalServerError)
|
||
|
type v struct {
|
||
|
Title string
|
||
|
LoggedIn bool
|
||
|
Explanation string
|
||
|
Remediation string
|
||
|
}
|
||
|
s := v{
|
||
|
Title: "error",
|
||
|
LoggedIn: false,
|
||
|
Explanation: e.Explanation,
|
||
|
Remediation: e.Remediation,
|
||
|
}
|
||
|
err := T["error.html"].ExecuteTemplate(w, "error.html", s)
|
||
|
if err != nil {
|
||
|
fmt.Println(err)
|
||
|
}
|
||
|
return
|
||
|
|
||
|
}
|