textbook/flash

Errors on initial load if fetches fail

Opened this issue · 0 comments

By default, the various update implementations return an empty dictionary if something goes wrong. This is not gracefully handled by the initial load templating:

   2019-11-04T22:31:43.79+0000 [APP/PROC/WEB/0] OUT   File "/home/vcap/app/flash/templates/home.html", line 1, in top-level template code
   2019-11-04T22:31:43.79+0000 [APP/PROC/WEB/0] OUT     {% extends "base.html" %}
   2019-11-04T22:31:43.79+0000 [APP/PROC/WEB/0] OUT   File "/home/vcap/app/flash/templates/base.html", line 20, in top-level template code
   2019-11-04T22:31:43.79+0000 [APP/PROC/WEB/0] OUT     {% block body %}{% endblock %}
   2019-11-04T22:31:43.79+0000 [APP/PROC/WEB/0] OUT   File "/home/vcap/app/flash/templates/home.html", line 15, in block "body"
   2019-11-04T22:31:43.79+0000 [APP/PROC/WEB/0] OUT     {% include template %}
   2019-11-04T22:31:43.79+0000 [APP/PROC/WEB/0] OUT   File "/home/vcap/app/flash/templates/partials/vcs-section.html", line 3, in top-level template code
   2019-11-04T22:31:43.79+0000 [APP/PROC/WEB/0] OUT     {% set commit_data = service_data['commits'][i] or {} %}
   2019-11-04T22:31:43.79+0000 [APP/PROC/WEB/0] OUT   File "/home/vcap/deps/0/python/lib/python3.7/site-packages/jinja2/environment.py", line 411, in getitem
   2019-11-04T22:31:43.79+0000 [APP/PROC/WEB/0] OUT     return obj[argument]
   2019-11-04T22:31:43.79+0000 [APP/PROC/WEB/0] OUT jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'commits'
   2019-11-04T22:31:43.79+0000 [APP/PROC/WEB/0] OUT INFO:werkzeug:10.253.7.131 - - [04/Nov/2019 22:31:43] "GET / HTTP/1.1" 500 -