From e7e8eee28c836a37a066ee14b034ae7ea622e3ea Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Sun, 17 Apr 2016 12:17:37 +0300 Subject: [PATCH] throw Error -> Promise.reject --- src/components/auth/actions.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/auth/actions.js b/src/components/auth/actions.js index da05e08..9b48f44 100644 --- a/src/components/auth/actions.js +++ b/src/components/auth/actions.js @@ -35,7 +35,7 @@ export function login({login = '', password = '', rememberMe = false}) { } const errorMessage = resp.errors[Object.keys(resp.errors)[0]]; dispatch(setError(errorMessage)); - throw new Error(errorMessage); + return Promise.reject(errorMessage); } // TODO: log unexpected errors @@ -54,7 +54,7 @@ export function changePassword({ if (resp.errors) { const errorMessage = resp.errors[Object.keys(resp.errors)[0]]; dispatch(setError(errorMessage)); - throw new Error(errorMessage); + return Promise.reject(errorMessage); } // TODO: log unexpected errors @@ -86,7 +86,7 @@ export function register({ if (resp.errors) { const errorMessage = resp.errors[Object.keys(resp.errors)[0]]; dispatch(setError(errorMessage)); - throw new Error(errorMessage); + return Promise.reject(errorMessage); } // TODO: log unexpected errors @@ -114,7 +114,7 @@ export function activate({key = ''}) { .catch((resp) => { const errorMessage = resp.errors[Object.keys(resp.errors)[0]]; dispatch(setError(errorMessage)); - throw new Error(errorMessage); + return Promise.reject(errorMessage); // TODO: log unexpected errors })