From 31ca8b157982cae1624667c8d7011c06d3207a7b Mon Sep 17 00:00:00 2001 From: Laurence Maultsby Date: Mon, 10 Apr 2017 15:08:14 -0400 Subject: [PATCH] Display errors from back end on Accounts page in crouton Signed-off-by: Laurence Maultsby --- skyquake/plugins/accounts/src/account/account.jsx | 4 ++-- skyquake/plugins/accounts/src/account/accountSource.js | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/skyquake/plugins/accounts/src/account/account.jsx b/skyquake/plugins/accounts/src/account/account.jsx index b7dbf358c..4f011cb1a 100644 --- a/skyquake/plugins/accounts/src/account/account.jsx +++ b/skyquake/plugins/accounts/src/account/account.jsx @@ -106,8 +106,8 @@ class Account extends React.Component { self.props.router.push({pathname:'accounts'}); self.props.flux.actions.global.hideScreenLoader.defer(); }, - function() { - self.props.flux.actions.global.showNotification("There was an error creating your account. Please contact your system administrator."); + function(error) { + self.props.flux.actions.global.showNotification(error); self.props.flux.actions.global.hideScreenLoader.defer(); }); } diff --git a/skyquake/plugins/accounts/src/account/accountSource.js b/skyquake/plugins/accounts/src/account/accountSource.js index 52af8578b..45da0fb9a 100644 --- a/skyquake/plugins/accounts/src/account/accountSource.js +++ b/skyquake/plugins/accounts/src/account/accountSource.js @@ -50,6 +50,7 @@ module.exports = function(Alt) { }).fail(function(xhr){ //Authentication and the handling of fail states should be wrapped up into a connection class. Utils.checkAuthentication(xhr.status); + reject(xhr.responseText || 'An error occurred. Check your logs for more information'); });; }); }, @@ -133,7 +134,7 @@ module.exports = function(Alt) { }).fail(function(xhr){ //Authentication and the handling of fail states should be wrapped up into a connection class. Utils.checkAuthentication(xhr.status); - reject(); + reject(xhr.responseText || 'An error occurred. Check your logs for more information'); }); }); @@ -177,7 +178,7 @@ module.exports = function(Alt) { }).fail(function(xhr){ //Authentication and the handling of fail states should be wrapped up into a connection class. Utils.checkAuthentication(xhr.status); - reject('error'); + reject(xhr.responseText || 'An error occurred. Check your logs for more information'); }); }); @@ -204,7 +205,7 @@ module.exports = function(Alt) { }).fail(function(xhr){ //Authentication and the handling of fail states should be wrapped up into a connection class. Utils.checkAuthentication(xhr.status); - reject('error'); + reject(xhr.responseText || 'An error occurred. Check your logs for more information'); }); }) }, -- 2.25.1