consensus/cmd/web/views/error.qtpl
DataHoarder 71689792e6
All checks were successful
continuous-integration/drone/push Build is passing
Convert web templates to quicktemplate for speedup, remove usages of stick
2023-05-27 13:08:22 +02:00

32 lines
728 B
Plaintext

{% import "fmt" %}
{% code
type ErrorPage struct {
// inherit from base page, so its' title is used in error page.
BasePage
Code int
Message string
Error any
}
%}
{% func (p *ErrorPage) Title() %}
{%= p.BasePage.Title() %} - Error {%d p.Code %}
{% endfunc %}
{% func (p *ErrorPage) Content() %}
<div class="center" style="text-align: center">
<h2>Error {%d p.Code %} - {%s p.Message %}</h2>
{% if p.Error != nil %}
<div class="center" style="text-align: center">{%s fmt.Sprintf("%s", p.Error) %}</div>
{% endif %}
</div>
{% endfunc %}
{% code
func NewErrorPage(code int, message string, err any) *ErrorPage {
return &ErrorPage{Code: code, Message: message, Error: err}
}
%}