improve handling of ratchet error

This commit is contained in:
Josh Harvey 2018-01-25 20:15:22 +02:00
parent fc17d2cdf8
commit d7a5734818
4 changed files with 6 additions and 3 deletions

View file

@ -123,7 +123,9 @@ function postTx (req, res, next) {
return res.json(tx)
})
.catch(err => {
if (err instanceof E.StaleTxError) return res.status(404).json({})
if (err instanceof E.StaleTxError) return res.status(409).json({})
if (err instanceof E.RatchetError) return res.status(409).json({})
throw err
})
.catch(next)