auth/web/error.qtpl

42 lines
756 B
Plaintext

{% import (
"errors"
"source.toby3d.me/toby3d/auth/internal/domain"
) %}
{% code type ErrorPage struct {
BaseOf
Error error
} %}
{% collapsespace %}
{% func (p *ErrorPage) title() %}
{%s p.t("Error") %}
{% endfunc %}
{% func (p *ErrorPage) body() %}
<main>
{% code err := new(domain.Error) %}
{% if errors.As(p.Error, err) %}
<h1>{%s err.Code.String() %}</h1>
{% if err.Description != "" %}
<p>{%s err.Description %}</p>
{% endif %}
{% if err.URI != "" %}
<a rel="noreferrer noopener"
href="{%s err.URI %}"
target="_blank">
{%s p.t("How do I fix it?") %}
</a>
{% endif %}
{% else %}
<h1>{%s p.t("Error") %}</h1>
<p>{%s p.Error.Error() %}</p>
{% endif %}
</main>
{% endfunc %}
{% endcollapsespace %}