Slack messaging #169

Merged
bones7242 merged 11 commits from slack-messaging into master 2017-09-21 21:11:32 +02:00
4 changed files with 8 additions and 10 deletions
Showing only changes of commit ebff2cf62b - Show all commits

View file

@ -35,7 +35,7 @@ module.exports = {
}); });
}) })
.catch(error => { .catch(error => {
logger.error('Sequelize error', error); logger.error('Sequelize error >>', error);
}); });
}, },
sendGoogleAnalytics (action, headers, ip, originalUrl) { sendGoogleAnalytics (action, headers, ip, originalUrl) {
@ -137,7 +137,7 @@ module.exports = {
resolve({ records: resultHashTable, totals: { totalServe, totalPublish, totalShow, totalCount, totalSuccess, totalFailure }, percentSuccess }); resolve({ records: resultHashTable, totals: { totalServe, totalPublish, totalShow, totalCount, totalSuccess, totalFailure }, percentSuccess });
}) })
.catch(error => { .catch(error => {
logger.error('sequelize error', error); logger.error('sequelize error >>', error);
reject(error); reject(error);
}); });
}); });
@ -161,7 +161,7 @@ module.exports = {
resolve(results); resolve(results);
}) })
.catch(error => { .catch(error => {
logger.error('sequelize error', error); logger.error('sequelize error >>', error);
reject(error); reject(error);
}); });
}); });

View file

@ -3,7 +3,7 @@ const { postToStats } = require('../controllers/statsController.js');
module.exports = { module.exports = {
handleRequestError (action, originalUrl, ip, error, res) { handleRequestError (action, originalUrl, ip, error, res) {
logger.error('Request Error >>', error); logger.error(`Request Error >> ${error.message}`, error);
if (error.response) { if (error.response) {
kauffj commented 2017-09-16 00:18:31 +02:00 (Migrated from github.com)
Review

When is there a non-enumerable property being passed that this is required?

When is there a non-enumerable property being passed that this is required?
bones7242 commented 2017-09-21 21:10:37 +02:00 (Migrated from github.com)
Review

for errors created by node (e.g. new Error('error message')) the stack and message are non-enumerable

for errors created by node (e.g. `new Error('error message')`) the stack and message are non-enumerable
postToStats(action, originalUrl, ip, null, null, error.response.data.error.messsage); postToStats(action, originalUrl, ip, null, null, error.response.data.error.messsage);
res.status(error.response.status).send(error.response.data.error.message); res.status(error.response.status).send(error.response.data.error.message);
@ -19,14 +19,12 @@ module.exports = {
} }
}, },
handlePublishError (error) { handlePublishError (error) {
logger.error(`Publish Error >> ${error.message}`, error);
if (error.code === 'ECONNREFUSED') { if (error.code === 'ECONNREFUSED') {
logger.error('Publish Error:', 'Connection refused. The daemon may not be running.');
return 'Connection refused. The daemon may not be running.'; return 'Connection refused. The daemon may not be running.';
} else if (error.response.data.error) { } else if (error.response.data.error) {
logger.error('Publish Error:', error.response.data.error);
return error.response.data.error.message; return error.response.data.error.message;
} else { } else {
logger.error('Unhandled Publish Error:', error.message);
return error; return error;
} }
}, },

View file

@ -114,7 +114,7 @@ module.exports = {
} }
}) })
.catch((error) => { .catch((error) => {
logger.error('Unable to retrieve daemon download directory. Restart spee.ch once the daemon is ready. Using default "/home/lbry/Downloads".', error); logger.error('Unable to retrieve daemon download directory', error);
resolve('/home/lbry/Downloads/'); resolve('/home/lbry/Downloads/');
}); });
}); });

View file

@ -135,7 +135,7 @@ app.set('view engine', 'handlebars');
db.sequelize db.sequelize
.sync() // sync sequelize .sync() // sync sequelize
.then(() => { // get the download directory from the daemon .then(() => { // get the download directory from the daemon
logger.info('Retrieving daemon download directory'); logger.info('Retrieving daemon download directory...');
return getDownloadDirectory(); return getDownloadDirectory();
}) })
.then(hostedContentPath => { .then(hostedContentPath => {
@ -155,5 +155,5 @@ db.sequelize
}); });
}) })
.catch((error) => { .catch((error) => {
logger.error('Startup Error', error); logger.error(`Startup Error >> ${error.message}`, error);
}); });