From ba7494e067dd1abefd46dd5487f1dedeba2b91e1 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Sat, 3 Jun 2017 01:16:40 -0700 Subject: [PATCH] handled non-500 daemon errors --- helpers/routeHelpers.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/helpers/routeHelpers.js b/helpers/routeHelpers.js index e86bb1b6..6aa294c4 100644 --- a/helpers/routeHelpers.js +++ b/helpers/routeHelpers.js @@ -4,8 +4,10 @@ module.exports = { handleRequestError: function(error, res) { if ((error === "NO_CLAIMS") || (error === "NO_FREE_PUBLIC_CLAIMS")){ res.status(307).sendFile(path.join(__dirname, '../public', 'noClaims.html')); - } else if (error.response.status === 500) { - res.status(400).send(error.response.data.error.message); + } else if (error.response){ + res.status(error.response.status).send(error.response.data.error.message); + } else if (error.code === "ECONNREFUSED") { + res.status(400).send("Connection refused. The daemon may not be running."); } else { res.status(400).send(error.toString()); };