Remove various uses of INTERNAL_ERROR

INTERNAL_ERROR now means there really was some internal error
This commit is contained in:
Girish Ramakrishnan
2019-10-24 18:32:33 -07:00
parent 6e57f8cc03
commit ad9097d212
9 changed files with 19 additions and 21 deletions

View File

@@ -260,13 +260,13 @@ function prepareDashboardDomain(domain, auditSource, callback) {
const fqdn = domains.fqdn(constants.ADMIN_LOCATION, domainObject);
apps.getAll(function (error, result) {
if (error) return callback(new BoxError(BoxError.INTERNAL_ERROR, error));
if (error) return callback(error);
const conflict = result.filter(app => app.fqdn === fqdn);
if (conflict.length) return callback(new BoxError(BoxError.BAD_STATE, 'Dashboard location conflicts with an existing app'));
tasks.add(tasks.TASK_PREPARE_DASHBOARD_DOMAIN, [ domain, auditSource ], function (error, taskId) {
if (error) return callback(new BoxError(BoxError.INTERNAL_ERROR, error));
if (error) return callback(error);
tasks.startTask(taskId, {}, NOOP_CALLBACK);
@@ -288,7 +288,7 @@ function setDashboardDomain(domain, auditSource, callback) {
if (error) return callback(error);
reverseProxy.writeAdminConfig(domain, function (error) {
if (error) return callback(new BoxError(BoxError.INTERNAL_ERROR, error));
if (error) return callback(error);
const fqdn = domains.fqdn(constants.ADMIN_LOCATION, domainObject);
@@ -296,7 +296,7 @@ function setDashboardDomain(domain, auditSource, callback) {
(done) => settings.setAdmin(domain, fqdn, done),
(done) => clients.addDefaultClients(settings.adminOrigin(), done)
], function (error) {
if (error) return callback(new BoxError(BoxError.INTERNAL_ERROR, error));
if (error) return callback(error);
eventlog.add(eventlog.ACTION_DASHBOARD_DOMAIN_UPDATE, auditSource, { domain: domain, fqdn: fqdn });
@@ -340,7 +340,7 @@ function renewCerts(options, auditSource, callback) {
assert.strictEqual(typeof callback, 'function');
tasks.add(tasks.TASK_RENEW_CERTS, [ options, auditSource ], function (error, taskId) {
if (error) return callback(new BoxError(BoxError.INTERNAL_ERROR, error));
if (error) return callback(error);
tasks.startTask(taskId, {}, NOOP_CALLBACK);