diff --git a/client/lib/handleError.js b/client/lib/handleError.js index 9fdd054cd43..84aa1cf60fd 100644 --- a/client/lib/handleError.js +++ b/client/lib/handleError.js @@ -12,7 +12,12 @@ this.handleError = function(error, useToastr = true) { } if (useToastr) { - return toastr.error(s.escapeHTML(TAPi18n.__(error.error, error.details)), error.details && error.details.errorTitle ? s.escapeHTML(TAPi18n.__(error.details.errorTitle)) : null); + const details = Object.entries(error.details || {}) + .reduce((obj, [ key, value ]) => ({ ...obj, [key] : s.escapeHTML(value) }), {}); + const message = TAPi18n.__(error.error, details); + const title = details.errorTitle && TAPi18n.__(details.errorTitle); + + return toastr.error(message, title); } return s.escapeHTML(TAPi18n.__(error.error, error.details));