From 8747ccc105390f00cc719c1e7b28ef73cccd8c8d Mon Sep 17 00:00:00 2001 From: yuri Date: Wed, 29 Jul 2015 15:06:03 +0300 Subject: [PATCH] show error message reason --- frontend/client/src/app.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/frontend/client/src/app.js b/frontend/client/src/app.js index 000dae5f6a..e973438c34 100644 --- a/frontend/client/src/app.js +++ b/frontend/client/src/app.js @@ -454,6 +454,8 @@ Espo.define( if (xhr.errorIsHandled) { return; } + var statusReason = xhr.getResponseHeader('X-Status-Reason'); + switch (xhr.status) { case 0: if (xhr.statusText == 'timeout') { @@ -476,23 +478,30 @@ Espo.define( if (options.main) { self.baseController.error403(); } else { - Espo.Ui.error(self.language.translate('Error') + ' ' + xhr.status); + var msg = self.language.translate('Error') + ' ' + xhr.status; + if (statusReason) { + msg += ': ' + statusReason; + } + Espo.Ui.error(msg); } break; case 404: if (options.main) { self.baseController.error404(); } else { - Espo.Ui.error(self.language.translate('Error') + ' ' + xhr.status); + var msg = self.language.translate('Error') + ' ' + xhr.status; + if (statusReason) { + msg += ': ' + statusReason; + } + Espo.Ui.error(msg); } break; default: Espo.Ui.error(self.language.translate('Error') + ' ' + xhr.status); } - var statusReason = xhr.getResponseHeader('X-Status-Reason'); if (statusReason) { - console.error('Server side error: ' + statusReason); + console.error('Server side error '+xhr.status+': ' + statusReason); } }); },