Move GroupsError to BoxError

This commit is contained in:
Girish Ramakrishnan
2019-10-22 16:34:17 -07:00
parent 1b594d3e50
commit 2d115d3d0f
4 changed files with 71 additions and 91 deletions

View File

@@ -34,6 +34,7 @@ exports = module.exports = {
};
let assert = require('assert'),
BoxError = require('./boxerror.js'),
crypto = require('crypto'),
constants = require('./constants.js'),
debug = require('debug')('box:user'),
@@ -42,7 +43,6 @@ let assert = require('assert'),
externalldap = require('./externalldap.js'),
ExternalLdapError = externalldap.ExternalLdapError,
groups = require('./groups.js'),
GroupsError = groups.GroupsError,
hat = require('./hat.js'),
mailer = require('./mailer.js'),
qrcode = require('qrcode'),
@@ -472,7 +472,7 @@ function setMembership(userId, groupIds, callback) {
assert.strictEqual(typeof callback, 'function');
groups.setMembership(userId, groupIds, function (error) {
if (error && error.reason === GroupsError.NOT_FOUND) return callback(new UsersError(UsersError.NOT_FOUND, 'One or more groups not found'));
if (error && error.reason === BoxError.NOT_FOUND) return callback(new UsersError(UsersError.NOT_FOUND, 'One or more groups not found'));
if (error) return callback(new UsersError(UsersError.INTERNAL_ERROR, error));
callback(null);