diff --git a/src/apptask.js b/src/apptask.js index 80be93902..498162b3e 100644 --- a/src/apptask.js +++ b/src/apptask.js @@ -22,6 +22,7 @@ var assert = require('assert'), net = require('net'), config = require('../config.js'), database = require('./database.js'), + DatabaseError = require('./databaseerror.js'), ejs = require('ejs'), appFqdn = require('./apps').appFqdn; @@ -311,7 +312,12 @@ function removeOAuthCredentials(app, callback) { debug('removeOAuthCredentials:', app.id); - clientdb.del(app.id, callback); + clientdb.del(app.id, function (error) { + if (error && error.reason === DatabaseError.NOT_FOUND) return callback(null); + + if (error) console.error(error); + callback(null); + }); } function startContainer(app, callback) { diff --git a/src/clientdb.js b/src/clientdb.js index 15fb95f46..24b274dc7 100644 --- a/src/clientdb.js +++ b/src/clientdb.js @@ -2,7 +2,7 @@ 'use strict'; -var DatabaseError = require('./databaseerror'), +var DatabaseError = require('./databaseerror.js'), path = require('path'), debug = require('debug')('box:clientdb'), database = require('./database.js'), diff --git a/src/test/apptask-test.js b/src/test/apptask-test.js index df2ec34dd..c775215ce 100644 --- a/src/test/apptask-test.js +++ b/src/test/apptask-test.js @@ -133,10 +133,9 @@ describe('apptask', function () { }); }); - it('remove OAuth credentials twice fails', function (done) { + it('remove OAuth credentials twice succeeds', function (done) { apptask._removeOAuthCredentials(APP, function (error) { - expect(error).to.be.a(DatabaseError); - expect(error.reason).to.equal(DatabaseError.NOT_FOUND); + expect(!error).to.be.ok(); done(); }); });