Fix up various flow issues.
This commit is contained in:
parent
08bd7da33f
commit
0d8a8547f5
8 changed files with 60 additions and 40 deletions
|
|
@ -188,19 +188,6 @@ function pair (req, res, next) {
|
|||
.catch(next)
|
||||
}
|
||||
|
||||
function phoneCode (req, res, next) {
|
||||
const pi = plugins(req.settings, req.deviceId)
|
||||
const phone = req.body.phone
|
||||
|
||||
return pi.getPhoneCode(phone)
|
||||
.then(code => respond(req, res, {code}))
|
||||
.catch(err => {
|
||||
if (err.name === 'BadNumberError') throw httpError('Bad number', 410)
|
||||
throw err
|
||||
})
|
||||
.catch(next)
|
||||
}
|
||||
|
||||
function errorHandler (err, req, res, next) {
|
||||
const statusCode = err.name === 'HTTPError'
|
||||
? err.code || 500
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue