From c6cf817b2c897234fd312a6b0280f0f2ea3c4f8f Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Mon, 9 Jan 2017 21:22:13 -0500 Subject: [PATCH] Fix ajax error handling --- js/actions/AccountActions.js | 8 ++++---- js/actions/ErrorActions.js | 2 +- js/actions/SecurityActions.js | 8 ++++---- js/actions/SecurityTemplateActions.js | 2 +- js/actions/UserActions.js | 12 ++++++------ 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/js/actions/AccountActions.js b/js/actions/AccountActions.js index 4eb716f..ff3bded 100644 --- a/js/actions/AccountActions.js +++ b/js/actions/AccountActions.js @@ -87,7 +87,7 @@ function fetchAll() { } }, error: function(jqXHR, status, error) { - dispatch(ErrorActions.ajaxError(e)); + dispatch(ErrorActions.ajaxError(error)); } }); }; @@ -114,7 +114,7 @@ function create(account) { } }, error: function(jqXHR, status, error) { - dispatch(ErrorActions.ajaxError(e)); + dispatch(ErrorActions.ajaxError(error)); } }); }; @@ -141,7 +141,7 @@ function update(account) { } }, error: function(jqXHR, status, error) { - dispatch(ErrorActions.ajaxError(e)); + dispatch(ErrorActions.ajaxError(error)); } }); }; @@ -165,7 +165,7 @@ function remove(account) { } }, error: function(jqXHR, status, error) { - dispatch(ErrorActions.ajaxError(e)); + dispatch(ErrorActions.ajaxError(error)); } }); }; diff --git a/js/actions/ErrorActions.js b/js/actions/ErrorActions.js index 38479b4..84532a9 100644 --- a/js/actions/ErrorActions.js +++ b/js/actions/ErrorActions.js @@ -13,7 +13,7 @@ function serverError(error) { function ajaxError(error) { var e = new Error(); e.ErrorId = 5; - e.ErrorString = "Request Failed: " + status + error; + e.ErrorString = "Request Failed: " + error; return { type: ErrorConstants.ERROR_AJAX, diff --git a/js/actions/SecurityActions.js b/js/actions/SecurityActions.js index cd85d9f..6963b66 100644 --- a/js/actions/SecurityActions.js +++ b/js/actions/SecurityActions.js @@ -87,7 +87,7 @@ function fetchAll() { } }, error: function(jqXHR, status, error) { - dispatch(ErrorActions.ajaxError(e)); + dispatch(ErrorActions.ajaxError(error)); } }); }; @@ -114,7 +114,7 @@ function create(security) { } }, error: function(jqXHR, status, error) { - dispatch(ErrorActions.ajaxError(e)); + dispatch(ErrorActions.ajaxError(error)); } }); }; @@ -141,7 +141,7 @@ function update(security) { } }, error: function(jqXHR, status, error) { - dispatch(ErrorActions.ajaxError(e)); + dispatch(ErrorActions.ajaxError(error)); } }); }; @@ -165,7 +165,7 @@ function remove(security) { } }, error: function(jqXHR, status, error) { - dispatch(ErrorActions.ajaxError(e)); + dispatch(ErrorActions.ajaxError(error)); } }); }; diff --git a/js/actions/SecurityTemplateActions.js b/js/actions/SecurityTemplateActions.js index 022f1ba..a92ae37 100644 --- a/js/actions/SecurityTemplateActions.js +++ b/js/actions/SecurityTemplateActions.js @@ -51,7 +51,7 @@ function search(searchString, searchType, limit) { } }, error: function(jqXHR, status, error) { - dispatch(ErrorActions.ajaxError(e)); + dispatch(ErrorActions.ajaxError(error)); } }); }; diff --git a/js/actions/UserActions.js b/js/actions/UserActions.js index 33ec638..2bf8157 100644 --- a/js/actions/UserActions.js +++ b/js/actions/UserActions.js @@ -96,7 +96,7 @@ function fetch(userId) { } }, error: function(jqXHR, status, error) { - dispatch(ErrorActions.ajaxError(e)); + dispatch(ErrorActions.ajaxError(error)); } }); }; @@ -129,7 +129,7 @@ function create(user) { } }, error: function(jqXHR, status, error) { - dispatch(ErrorActions.ajaxError(e)); + dispatch(ErrorActions.ajaxError(error)); } }); }; @@ -156,7 +156,7 @@ function login(user) { } }, error: function(jqXHR, status, error) { - dispatch(ErrorActions.ajaxError(e)); + dispatch(ErrorActions.ajaxError(error)); } }); }; @@ -182,7 +182,7 @@ function tryResumingSession() { } }, error: function(jqXHR, status, error) { - dispatch(ErrorActions.ajaxError(e)); + dispatch(ErrorActions.ajaxError(error)); } }); }; @@ -206,7 +206,7 @@ function logout() { } }, error: function(jqXHR, status, error) { - dispatch(ErrorActions.ajaxError(e)); + dispatch(ErrorActions.ajaxError(error)); } }); }; @@ -233,7 +233,7 @@ function update(user) { } }, error: function(jqXHR, status, error) { - dispatch(ErrorActions.ajaxError(e)); + dispatch(ErrorActions.ajaxError(error)); } }); };