Merge pull request #1209 from softworkz/AutoOrganizeErrorHandling

Auto-Organize: Display errors in client on server exceptions
This commit is contained in:
Luke 2015-10-04 23:24:13 -04:00
commit 4bc4e81c51
3 changed files with 18 additions and 9 deletions

View File

@ -44,7 +44,7 @@
reloadItems(page); reloadItems(page);
}); }).fail(onApiFailure);
} }
}); });
@ -60,11 +60,9 @@
sortBy: 'SortName' sortBy: 'SortName'
}).done(function (result) { }).done(function (result) {
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
showEpisodeCorrectionPopup(page, item, result.Items); showEpisodeCorrectionPopup(page, item, result.Items);
}); }).fail(onApiFailure);
} }
@ -129,8 +127,7 @@
reloadItems(page); reloadItems(page);
}); }).fail(onApiFailure);
} }
}); });
@ -160,7 +157,7 @@
reloadItems(page); reloadItems(page);
}); }).fail(onApiFailure);
} }
function reloadItems(page) { function reloadItems(page) {
@ -173,7 +170,7 @@
renderResults(page, result); renderResults(page, result);
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
}); }).fail(onApiFailure);
} }
@ -333,6 +330,16 @@
} }
} }
function onApiFailure(e) {
Dashboard.hideLoadingMsg();
Dashboard.alert({
title: Globalize.translate('AutoOrganizeError'),
message: e.status + ' - ' + e.statusText + '<br>' + e.getResponseHeader("X-Application-Error-Code")
});
}
function onEpisodeCorrectionFormSubmit() { function onEpisodeCorrectionFormSubmit() {
submitEpisodeForm(this); submitEpisodeForm(this);
return false; return false;
@ -346,7 +353,7 @@
ApiClient.clearOrganizationLog().done(function () { ApiClient.clearOrganizationLog().done(function () {
reloadItems(page); reloadItems(page);
}); }).fail(onApiFailure);
}); });

View File

@ -256,6 +256,7 @@
"HeaderSelectWatchFolder": "Select Watch Folder", "HeaderSelectWatchFolder": "Select Watch Folder",
"HeaderSelectWatchFolderHelp": "Browse or enter the path to your watch folder. The folder must be writeable.", "HeaderSelectWatchFolderHelp": "Browse or enter the path to your watch folder. The folder must be writeable.",
"OrganizePatternResult": "Result: {0}", "OrganizePatternResult": "Result: {0}",
"AutoOrganizeError": "Error Organizing File",
"HeaderRestart": "Restart", "HeaderRestart": "Restart",
"HeaderShutdown": "Shutdown", "HeaderShutdown": "Shutdown",
"MessageConfirmRestart": "Are you sure you wish to restart Emby Server?", "MessageConfirmRestart": "Are you sure you wish to restart Emby Server?",

View File

@ -259,6 +259,7 @@
"HeaderSelectWatchFolder": "Select Watch Folder", "HeaderSelectWatchFolder": "Select Watch Folder",
"HeaderSelectWatchFolderHelp": "Browse or enter the path to your watch folder. The folder must be writeable.", "HeaderSelectWatchFolderHelp": "Browse or enter the path to your watch folder. The folder must be writeable.",
"OrganizePatternResult": "Result: {0}", "OrganizePatternResult": "Result: {0}",
"AutoOrganizeError": "Error Organizing File",
"HeaderRestart": "Restart", "HeaderRestart": "Restart",
"HeaderShutdown": "Shutdown", "HeaderShutdown": "Shutdown",
"MessageConfirmRestart": "Are you sure you wish to restart Emby Server?", "MessageConfirmRestart": "Are you sure you wish to restart Emby Server?",