From 4be23e5fc7640cb9bbe774a92031a5fbe75c796b Mon Sep 17 00:00:00 2001 From: Joseph Earl Date: Fri, 14 Apr 2017 17:12:13 +0100 Subject: [PATCH] Show error if config fails to parse --- src/actions/config.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/actions/config.js b/src/actions/config.js index 6f6893e7..330bee55 100644 --- a/src/actions/config.js +++ b/src/actions/config.js @@ -73,20 +73,20 @@ export function loadConfig() { return (dispatch) => { dispatch(configLoading()); - fetch("config.yml", { credentials: 'same-origin' }).then((response) => { + fetch("config.yml", { credentials: 'same-origin' }) + .then((response) => { if (response.status !== 200) { throw new Error(`Failed to load config.yml (${ response.status })`); } - - response - .text() - .then(parseConfig) - .then(applyDefaults) - .then((config) => { - dispatch(configDidLoad(config)); - dispatch(authenticateUser()); - }); - }).catch((err) => { + return response.text(); + }) + .then(parseConfig) + .then(applyDefaults) + .then((config) => { + dispatch(configDidLoad(config)); + dispatch(authenticateUser()); + }) + .catch((err) => { dispatch(configFailed(err)); }); };