DataHoarder
55661a12da
All checks were successful
continuous-integration/drone/push Build is passing
36 lines
786 B
Plaintext
36 lines
786 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) Name() string {
|
|
return "error"
|
|
}
|
|
%}
|
|
|
|
{% 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}
|
|
}
|
|
|
|
%} |