Catch json parse error for current activity
This commit is contained in:
@@ -103,10 +103,20 @@
|
|||||||
type: 'GET',
|
type: 'GET',
|
||||||
cache: false,
|
cache: false,
|
||||||
async: true,
|
async: true,
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
console.log(status + ': ' + error);
|
||||||
|
},
|
||||||
complete: function (xhr, status) {
|
complete: function (xhr, status) {
|
||||||
$('#dashboard-checking-activity').remove();
|
$('#dashboard-checking-activity').remove();
|
||||||
|
|
||||||
var current_activity = $.parseJSON(xhr.responseText);
|
var current_activity;
|
||||||
|
try {
|
||||||
|
current_activity = $.parseJSON(xhr.responseText);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(status + ': ' + e);
|
||||||
|
current_activity = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(current_activity)) {
|
if (!(current_activity)) {
|
||||||
$('#currentActivity').html('<div id="dashboard-no-activity" class="text-muted">There was an error communicating with your Plex Server.</div>');
|
$('#currentActivity').html('<div id="dashboard-no-activity" class="text-muted">There was an error communicating with your Plex Server.</div>');
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user