UI error if buildgraph is not yet finished

This commit is contained in:
Laura Klünder 2016-12-21 11:55:04 +01:00
parent 1a86b826e6
commit d5a52bf9e3
4 changed files with 22 additions and 8 deletions

View file

@ -76,6 +76,11 @@
{% elif error == 'alreadythere' %}
<div class="alert alert-success">
<strong>{% trans 'Congratulations, you are already there!' %}</strong>
</div>
{% elif error == 'notyetroutable' %}
<div class="alert alert-danger">
<strong>{% trans 'One or both of your locations are not in the routing table yet.' %}</strong>
<p>{% trans 'Please try again in a few minutes.' %}</p>
</div>
{% endif %}
{% if route %}

View file

@ -11,7 +11,7 @@ from c3nav.mapdata.permissions import get_excludables_includables
from c3nav.mapdata.render.compose import composer
from c3nav.mapdata.utils.cache import get_levels_cached
from c3nav.mapdata.utils.misc import get_dimensions
from c3nav.routing.exceptions import AlreadyThere, NoRouteFound
from c3nav.routing.exceptions import AlreadyThere, NoRouteFound, NotYetRoutable
from c3nav.routing.graph import Graph
ctype_mapping = {
@ -190,6 +190,8 @@ def main(request, location=None, origin=None, destination=None):
ctx.update({'error': 'noroutefound'})
except AlreadyThere:
ctx.update({'error': 'alreadythere'})
except NotYetRoutable:
ctx.update({'error': 'notyetroutable'})
else:
ctx.update({'route': route})