From 932fad9161e435904e0c51fc19dccc2f53d751a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 4 Oct 2016 14:24:27 +0200 Subject: [PATCH] Properly handle errors opening tasks/shots. --- src/scripts/tutti/10_tasks.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/scripts/tutti/10_tasks.js b/src/scripts/tutti/10_tasks.js index 9f71a02..4816b68 100644 --- a/src/scripts/tutti/10_tasks.js +++ b/src/scripts/tutti/10_tasks.js @@ -45,7 +45,14 @@ function item_open(item_id, item_type, pushState) console.log('Error fetching task', item_id, 'from', item_url); console.log('XHR:', xhr); } - $('#item-details').html(xhr.responseText); + $('#status-bar').text('Opening ' + item_type + ' failed.'); + if (xhr.status) { + $('#item-details').html(xhr.responseText); + } else { + $('#item-details').html('

Opening ' + item_type + ' failed. There possibly was ' + + 'an error connecting to the server. Please check your network connection and ' + + 'try again.

'); + } }); // Determine whether we should push the new state or not.