Start moving db code to use BoxError as well

This commit is contained in:
Girish Ramakrishnan
2019-10-24 11:13:48 -07:00
parent ec216d9828
commit a017af41c5
30 changed files with 396 additions and 447 deletions

View File

@@ -25,7 +25,6 @@ var apps = require('../apps.js'),
BoxError = require('../boxerror.js'),
clients = require('../clients'),
constants = require('../constants.js'),
DatabaseError = require('../databaseerror.js'),
debug = require('debug')('box:routes/oauth2'),
eventlog = require('../eventlog.js'),
hat = require('../hat.js'),
@@ -89,7 +88,7 @@ function initialize() {
// exchange authorization codes for access tokens. this is used by external oauth clients
gServer.exchange(oauth2orize.exchange.code(function (client, code, redirectURI, callback) {
authcodedb.get(code, function (error, authCode) {
if (error && error.reason === DatabaseError.NOT_FOUND) return callback(null, false);
if (error && error.reason === BoxError.NOT_FOUND) return callback(null, false);
if (error) return callback(error);
if (client.id !== authCode.clientId) return callback(null, false);