error logging

This commit is contained in:
Overtorment 2020-01-18 13:39:55 +00:00 committed by GitHub
parent 1e17b9925b
commit b56064a7ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -255,11 +255,16 @@ router.get('/balance', postLimiter, async function(req, res) {
return errorBadAuth(res);
}
if (!(await u.getAddress())) await u.generateAddress(); // onchain address needed further
await u.accountForPosibleTxids();
let balance = await u.getBalance();
if (balance < 0) balance = 0;
res.send({ BTC: { AvailableBalance: balance } });
try {
if (!(await u.getAddress())) await u.generateAddress(); // onchain address needed further
await u.accountForPosibleTxids();
let balance = await u.getBalance();
if (balance < 0) balance = 0;
res.send({ BTC: { AvailableBalance: balance } });
} catch (Error) {
logger.log('', [req.id, 'error:', Error]);
return errorGeneralServerError(res);
}
});
router.get('/getinfo', postLimiter, async function(req, res) {