Skip to content

Commit

Permalink
normalized expected error format according to JSON API standard #30
Browse files Browse the repository at this point in the history
  • Loading branch information
psolom committed Nov 24, 2017
1 parent e639c42 commit ce49f69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions scripts/filemanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -3045,13 +3045,13 @@ $.richFilemanagerPlugin = function(element, pluginOptions)
var formatServerError = function(errorObject) {
var message;
// look for message in case an error CODE is provided
if (langModel.getLang() && lg(errorObject.message)) {
message = lg(errorObject.message);
$.each(errorObject.arguments, function(i, argument) {
if (langModel.getLang() && lg(errorObject.title)) {
message = lg(errorObject.title);
$.each(errorObject.meta.arguments, function(i, argument) {
message = message.replace('%s', argument);
});
} else {
message = errorObject.message;
message = errorObject.title;
}
return message;
};
Expand All @@ -3077,8 +3077,8 @@ $.richFilemanagerPlugin = function(element, pluginOptions)
$.each(response.errors, function(i, errorObject) {
fm.error(formatServerError(errorObject));

if (errorObject.arguments.redirect) {
window.location.href = errorObject.arguments.redirect;
if (errorObject.meta.arguments.redirect) {
window.location.href = errorObject.meta.arguments.redirect;
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/filemanager.min.js

Large diffs are not rendered by default.

0 comments on commit ce49f69

Please sign in to comment.