Slack messaging #169
2 changed files with 4 additions and 7 deletions
|
@ -3,23 +3,20 @@ 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);
|
||||||
|
postToStats(action, originalUrl, ip, null, null, error);
|
||||||
for errors created by node (e.g. for errors created by node (e.g. `new Error('error message')`) the stack and message are non-enumerable
|
|||||||
if (error.response) {
|
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);
|
res.status(error.response.status).send(error.response.data.error.message);
|
||||||
} else if (error.code === 'ECONNREFUSED') {
|
} else if (error.code === 'ECONNREFUSED') {
|
||||||
postToStats(action, originalUrl, ip, null, null, 'Connection refused. The daemon may not be running.');
|
|
||||||
res.status(503).send('Connection refused. The daemon may not be running.');
|
res.status(503).send('Connection refused. The daemon may not be running.');
|
||||||
} else if (error.message) {
|
} else if (error.message) {
|
||||||
postToStats(action, originalUrl, ip, null, null, error);
|
|
||||||
res.status(400).send(error.message);
|
res.status(400).send(error.message);
|
||||||
} else {
|
} else {
|
||||||
postToStats(action, originalUrl, ip, null, null, error);
|
|
||||||
res.status(400).send(error);
|
res.status(400).send(error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handlePublishError (error) {
|
handlePublishError (error) {
|
||||||
logger.error('Publish Error:', error);
|
logger.error('Publish Error:', error.message);
|
||||||
if (error.code === 'ECONNREFUSED') {
|
if (error.code === 'ECONNREFUSED') {
|
||||||
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) {
|
||||||
|
|
|
@ -115,7 +115,7 @@ module.exports = {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
logger.error('Lbrynet Error:', error);
|
logger.error('Lbrynet Error:', error.message);
|
||||||
resolve('/home/lbry/Downloads/');
|
resolve('/home/lbry/Downloads/');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue
When is there a non-enumerable property being passed that this is required?