From 3306513b0692c6495c5722ff5b68ac1ba1181c18 Mon Sep 17 00:00:00 2001 From: softworkz Date: Fri, 25 Sep 2015 11:36:01 +0200 Subject: [PATCH] Auto-Organize: Display errors in client on server exceptions When an exception occured on the server, the organize dialog or the confirm dialog were displayed eternally and not indication of failure was presented to the user Auto-Organize: Display errors in client on server exceptions When an exception occured on the server, the organize dialog or the confirm dialog were displayed eternally and not indication of failure was presented to the user --- dashboard-ui/scripts/autoorganizelog.js | 25 ++++++++++++------- dashboard-ui/strings/javascript/en-US.json | 1 + .../strings/javascript/javascript.json | 1 + 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/dashboard-ui/scripts/autoorganizelog.js b/dashboard-ui/scripts/autoorganizelog.js index f3370543a..4e07c5a8a 100644 --- a/dashboard-ui/scripts/autoorganizelog.js +++ b/dashboard-ui/scripts/autoorganizelog.js @@ -44,7 +44,7 @@ reloadItems(page); - }); + }).fail(onApiFailure); } }); @@ -60,11 +60,9 @@ sortBy: 'SortName' }).done(function (result) { - Dashboard.hideLoadingMsg(); - showEpisodeCorrectionPopup(page, item, result.Items); - }); + }).fail(onApiFailure); } @@ -129,8 +127,7 @@ reloadItems(page); - }); - + }).fail(onApiFailure); } }); @@ -160,7 +157,7 @@ reloadItems(page); - }); + }).fail(onApiFailure); } function reloadItems(page) { @@ -173,7 +170,7 @@ renderResults(page, result); Dashboard.hideLoadingMsg(); - }); + }).fail(onApiFailure); } @@ -333,6 +330,16 @@ } } + function onApiFailure(e) { + + Dashboard.hideLoadingMsg(); + + Dashboard.alert({ + title: Globalize.translate('AutoOrganizeError'), + message: e.status + ' - ' + e.statusText + '
' + e.getResponseHeader("X-Application-Error-Code") + }); + } + function onEpisodeCorrectionFormSubmit() { submitEpisodeForm(this); return false; @@ -346,7 +353,7 @@ ApiClient.clearOrganizationLog().done(function () { reloadItems(page); - }); + }).fail(onApiFailure); }); diff --git a/dashboard-ui/strings/javascript/en-US.json b/dashboard-ui/strings/javascript/en-US.json index 3d1d174e3..1b0d8c9d4 100644 --- a/dashboard-ui/strings/javascript/en-US.json +++ b/dashboard-ui/strings/javascript/en-US.json @@ -256,6 +256,7 @@ "HeaderSelectWatchFolder": "Select Watch Folder", "HeaderSelectWatchFolderHelp": "Browse or enter the path to your watch folder. The folder must be writeable.", "OrganizePatternResult": "Result: {0}", + "AutoOrganizeError": "Error Organizing File", "HeaderRestart": "Restart", "HeaderShutdown": "Shutdown", "MessageConfirmRestart": "Are you sure you wish to restart Emby Server?", diff --git a/dashboard-ui/strings/javascript/javascript.json b/dashboard-ui/strings/javascript/javascript.json index 31756f2d0..64634352d 100644 --- a/dashboard-ui/strings/javascript/javascript.json +++ b/dashboard-ui/strings/javascript/javascript.json @@ -257,6 +257,7 @@ "HeaderSelectWatchFolder": "Select Watch Folder", "HeaderSelectWatchFolderHelp": "Browse or enter the path to your watch folder. The folder must be writeable.", "OrganizePatternResult": "Result: {0}", + "AutoOrganizeError": "Error Organizing File", "HeaderRestart": "Restart", "HeaderShutdown": "Shutdown", "MessageConfirmRestart": "Are you sure you wish to restart Emby Server?",