improve the error message on domain removal
This commit is contained in:
+7
-1
@@ -309,7 +309,13 @@ function del(domain, auditSource, callback) {
|
||||
if (domain === settings.adminDomain()) return callback(new BoxError(BoxError.CONFLICT, 'Cannot remove admin domain'));
|
||||
|
||||
domaindb.del(domain, function (error) {
|
||||
if (error && error.reason === BoxError.CONFLICT) return callback(new BoxError(BoxError.CONFLICT, 'Could not remove domain. Check if this domain is in use by a mailbox or an app.'));
|
||||
if (error && error.reason === BoxError.CONFLICT) {
|
||||
if (error.message.indexOf('apps_mailDomain_constraint') !== -1) return callback(new BoxError(BoxError.CONFLICT, 'Domain is in use as the mailbox of an app. Check the Email section of each app.'));
|
||||
if (error.message.indexOf('subdomains') !== -1) return callback(new BoxError(BoxError.CONFLICT, 'Domain is in use by an app. Move the app first to a different location.'));
|
||||
if (error.message.indexOf('mail') !== -1) return callback(new BoxError(BoxError.CONFLICT, 'Domain is in use by a mailbox. Delete mailboxes first in the Email view.'));
|
||||
|
||||
// intentional fall through
|
||||
}
|
||||
if (error) return callback(error);
|
||||
|
||||
eventlog.add(eventlog.ACTION_DOMAIN_REMOVE, auditSource, { domain });
|
||||
|
||||
Reference in New Issue
Block a user