From fd382fcd9f10e5f3e12d078b656fab204ffee6ab Mon Sep 17 00:00:00 2001 From: bill bittner Date: Thu, 14 Sep 2017 09:35:58 -0700 Subject: [PATCH] updated logger.error usage format --- helpers/errorHandlers.js | 4 ++-- helpers/lbryApi.js | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/helpers/errorHandlers.js b/helpers/errorHandlers.js index 117f4529..6f2261b2 100644 --- a/helpers/errorHandlers.js +++ b/helpers/errorHandlers.js @@ -3,7 +3,7 @@ const { postToStats } = require('../controllers/statsController.js'); module.exports = { handleRequestError (action, originalUrl, ip, error, res) { - logger.error(`Request Error >> ${error.message}`, error); + logger.error('Request Error:', error); if (error.response) { postToStats(action, originalUrl, ip, null, null, error.response.data.error.messsage); res.status(error.response.status).send(error.response.data.error.message); @@ -19,7 +19,7 @@ module.exports = { } }, handlePublishError (error) { - logger.error(`Publish Error >> ${error.message}`, error); + logger.error('Publish Error:', error); if (error.code === 'ECONNREFUSED') { return 'Connection refused. The daemon may not be running.'; } else if (error.response.data.error) { diff --git a/helpers/lbryApi.js b/helpers/lbryApi.js index d082358d..3777c593 100644 --- a/helpers/lbryApi.js +++ b/helpers/lbryApi.js @@ -110,11 +110,12 @@ module.exports = { if (data.result) { resolve(data.result.download_directory); } else { - reject(new Error('Successfully connected to lbry daemon, but unable to retrieve the download directory.')); + // reject(new Error('Successfully connected to lbry daemon, but unable to retrieve the download directory.')); + return new Error('Successfully connected to lbry daemon, but unable to retrieve the download directory.'); } }) - .catch((error) => { - logger.error('Unable to retrieve daemon download directory', error); + .catch(error => { + logger.error('Lbrynet Error:', error); resolve('/home/lbry/Downloads/'); }); });