Skip to content

Commit 135deb9

Browse files
committed
if ajax requests fail, exceptions should be displayed instead of ambiguous message
1 parent 74a4992 commit 135deb9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

public/js/script.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ $('#upload-btn').click(function () {
5959
resetUploadForm();
6060
refreshFoldersAndItems(data);
6161
},
62-
error: function () {
62+
error: function (jqXHR, textStatus, errorThrown) {
63+
displayErrorResponse(jqXHR);
6364
resetUploadForm();
64-
notify('Action failed, due to server error.');
6565
}
6666
});
6767
});
@@ -143,11 +143,15 @@ function performLfmRequest(url, parameter, type) {
143143
url: lfm_route + '/' + url,
144144
data: data,
145145
cache: false
146-
}).fail(function () {
147-
notify('Action failed, due to server error.');
146+
}).fail(function (jqXHR, textStatus, errorThrown) {
147+
displayErrorResponse(jqXHR);
148148
});
149149
}
150150

151+
function displayErrorResponse(jqXHR) {
152+
notify('<div style="max-height:50vh;overflow: scroll;">' + jqXHR.responseText + '</div>');
153+
}
154+
151155
var refreshFoldersAndItems = function (data) {
152156
loadFolders();
153157
if (data != 'OK') {

0 commit comments

Comments
 (0)