Properly handle errors opening tasks/shots.

This commit is contained in:
2016-10-04 14:24:27 +02:00
parent 91abe917cd
commit 932fad9161

View File

@@ -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('<p class="text-danger">Opening ' + item_type + ' failed. There possibly was ' +
'an error connecting to the server. Please check your network connection and ' +
'try again.</p>');
}
});
// Determine whether we should push the new state or not.