Much better error page

This commit is contained in:
Simon Brooke 2018-09-23 11:22:54 +01:00
parent c1dcd33d82
commit 57182eb9a6
2 changed files with 30 additions and 32 deletions

View file

@ -2,24 +2,12 @@
{% block big-links %}
{% endblock %}
{% block content %}
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="col-lg-12">
<div class="centering text-center">
<div class="text-center">
<h1><span class="text-danger">Error: {{status}}</span></h1>
{% if status %}
<h2>Error: {{status}}</h2>
{% endif %}
<hr>
{% if title %}
<h2 class="without-margin">{{title}}</h2>
{% if error %}
<p>{{error}}</p>
{% endif %}
{% if message %}
<h4 class="text-danger">{{message}}</h4>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -113,6 +113,16 @@
returns a response map with the error page as the body
and the status specified by the status key"
[error-details]
(log/debug "Showing error page: " error-details)
{:status (:status error-details)
: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))})