Improved error handling

Invalid SQL now shows a special error.html template, and is covered by tests.
This commit is contained in:
Simon Willison 2017-11-12 13:16:15 -08:00
commit 666aa03253
4 changed files with 53 additions and 20 deletions

View file

@ -8,9 +8,6 @@
</head>
<body>
{% if error %}
<div style="padding: 1em; margin: 1em; border: 3px solid red;">{{ error }}</div>
{% endif %}
{% block content %}
{% endblock %}

View file

@ -0,0 +1,14 @@
{% extends "base.html" %}
{% block title %}{{ database }}{% endblock %}
{% block content %}
<div class="hd"><a href="/">home</a> / <a href="/{{ database }}-{{ database_hash }}">{{ database }}</a></div>
<h1 style="padding-left: 10px; border-left: 10px solid #{{ database_hash and database_hash[:6] }}">{{ database }}</h1>
{% if error %}
<div style="padding: 1em; margin: 1em; border: 3px solid red;">{{ error }}</div>
{% endif %}
{% endblock %}