Added some error handling if API returns an API error.

Caught the error and displayed an error PNG so it is obvious something
failed. Currently it displayed a thumbnail of a png over the top of the
loading page, and therefore it wasn't obvious of the state.
This commit is contained in:
Richard Chapman
2018-03-01 13:01:54 +00:00
committed by Ken Tsang
parent 64e706ec76
commit 1f69d882c2
4 changed files with 25 additions and 10 deletions

View File

@@ -35,11 +35,17 @@
Estimated delivery date: {{ estimated_letter_delivery_date|string|format_date_short }}
</p>
<p class="bottom-gutter">
<a href="{{ url_for('main.view_letter_notification_as_preview', service_id=current_service.id, notification_id=notification_id, filetype='pdf') }}" download>Download as a PDF</a>
</p>
{% if not error %}
<a href="{{ url_for('main.view_letter_notification_as_preview', service_id=current_service.id, notification_id=notification_id, filetype='pdf') }}" download>Download as a PDF</a>
{% endif %}
</p>
{% endif %}
{{ template|string }}
{% if error %}
Error Creating PDF Preview
{% else %}
{{ template|string }}
{% endif %}
{% if template.template_type != 'letter' %}
{{ ajax_block(partials, updates_url, 'status', finished=finished) }}