catch errors
This commit is contained in:
parent
71c239d432
commit
288ba30a16
1 changed files with 26 additions and 16 deletions
|
|
@ -3086,22 +3086,32 @@ module.exports = async (
|
|||
})
|
||||
|
||||
ap.post('/api/lnd/cb/:methodName', (req, res) => {
|
||||
const { lightning } = LightningServices.services
|
||||
const { methodName } = req.params
|
||||
const args = req.body
|
||||
try {
|
||||
const { lightning } = LightningServices.services
|
||||
const { methodName } = req.params
|
||||
const args = req.body
|
||||
|
||||
lightning[methodName](args, (err, lres) => {
|
||||
if (err) {
|
||||
res.status(500).json({
|
||||
errorMessage: err.details
|
||||
})
|
||||
} else if (lres) {
|
||||
res.status(200).json(lres)
|
||||
} else {
|
||||
res.status(500).json({
|
||||
errorMessage: 'Unknown error'
|
||||
})
|
||||
}
|
||||
})
|
||||
lightning[methodName](args, (err, lres) => {
|
||||
if (err) {
|
||||
res.status(500).json({
|
||||
errorMessage: err.details
|
||||
})
|
||||
} else if (lres) {
|
||||
res.status(200).json(lres)
|
||||
} else {
|
||||
res.status(500).json({
|
||||
errorMessage: 'Unknown error'
|
||||
})
|
||||
}
|
||||
})
|
||||
} catch (err) {
|
||||
logger.warn(`Error inside api cb:`)
|
||||
logger.error(err)
|
||||
logger.error(err.message)
|
||||
|
||||
return res.status(500).json({
|
||||
errorMessage: err.message
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue