diff --git a/lib/common.js b/lib/common.js index 70e5954..d11ad79 100644 --- a/lib/common.js +++ b/lib/common.js @@ -16,13 +16,16 @@ Common.prototype.notReady = function (err, res, p) { Common.prototype.handleErrors = function (err, res) { if (err) { if (err.code) { - res.status(400).send(err.message + '. Code:' + err.code); + if (!res.headerSent) + res.status(400).send(err.message + '. Code:' + err.code); } else { this.log.error(err.stack); - res.status(503).send(err.message); + if (!res.headerSent) + res.status(503).send(err.message); } } else { - res.status(404).send('Not found'); + if (!res.headerSent) + res.status(404).send('Not found'); } }; diff --git a/package.json b/package.json index 1b2f72c..295453a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "flosight-api", "description": "A Florincoin blockchain REST and web socket API service for Flocore Node.", - "version": "5.0.0-beta.68", + "version": "5.0.0-beta.69", "repository": "git://github.com/bitpay/flosight-api.git", "bugs": { "url": "https://github.com/bitpay/flosight-api/issues"