Much better error page
This commit is contained in:
parent
c1dcd33d82
commit
57182eb9a6
|
@ -2,24 +2,12 @@
|
||||||
{% block big-links %}
|
{% block big-links %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<body>
|
{% if status %}
|
||||||
<div class="container-fluid">
|
<h2>Error: {{status}}</h2>
|
||||||
<div class="row-fluid">
|
{% endif %}
|
||||||
<div class="col-lg-12">
|
<hr>
|
||||||
<div class="centering text-center">
|
{% if error %}
|
||||||
<div class="text-center">
|
<p>{{error}}</p>
|
||||||
<h1><span class="text-danger">Error: {{status}}</span></h1>
|
{% endif %}
|
||||||
<hr>
|
|
||||||
{% if title %}
|
|
||||||
<h2 class="without-margin">{{title}}</h2>
|
|
||||||
{% endif %}
|
|
||||||
{% if message %}
|
|
||||||
<h4 class="text-danger">{{message}}</h4>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -89,19 +89,19 @@
|
||||||
"renders the HTML `template` located relative to resources/templates in
|
"renders the HTML `template` located relative to resources/templates in
|
||||||
the context of this session and with these parameters."
|
the context of this session and with these parameters."
|
||||||
[template & [params]]
|
[template & [params]]
|
||||||
(log/debug (str "layout/render: template: '" template "'"))
|
(log/debug (str "layout/render: template: '" template "'"))
|
||||||
(content-type
|
(content-type
|
||||||
(ok
|
(ok
|
||||||
(parser/render-file
|
(parser/render-file
|
||||||
template
|
template
|
||||||
(merge params
|
(merge params
|
||||||
{:page template
|
{:page template
|
||||||
:csrf-token *anti-forgery-token*
|
:csrf-token *anti-forgery-token*
|
||||||
:user *user*
|
:user *user*
|
||||||
:user-roles (get-user-roles *user*)
|
:user-roles (get-user-roles *user*)
|
||||||
:site-title (:site-title env)
|
:site-title (:site-title env)
|
||||||
:version (System/getProperty "youyesyet.version")})))
|
:version (System/getProperty "youyesyet.version")})))
|
||||||
"text/html; charset=utf-8"))
|
"text/html; charset=utf-8"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,6 +113,16 @@
|
||||||
returns a response map with the error page as the body
|
returns a response map with the error page as the body
|
||||||
and the status specified by the status key"
|
and the status specified by the status key"
|
||||||
[error-details]
|
[error-details]
|
||||||
|
(log/debug "Showing error page: " error-details)
|
||||||
{:status (:status error-details)
|
{:status (:status error-details)
|
||||||
:headers {"Content-Type" "text/html; charset=utf-8"}
|
:headers {"Content-Type" "text/html; charset=utf-8"}
|
||||||
:body (render "error.html" {} error-details)})
|
:body (parser/render-file
|
||||||
|
"error.html"
|
||||||
|
(assoc
|
||||||
|
error-details
|
||||||
|
:site-title (:site-title env)
|
||||||
|
:title
|
||||||
|
(str "Apologies, we have a problem: "
|
||||||
|
(:title error-details))
|
||||||
|
:error (:message error-details)
|
||||||
|
:message nil))})
|
||||||
|
|
Loading…
Reference in a new issue