Fix error handling
This commit is contained in:
@@ -377,6 +377,8 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N
|
||||
enableBackup: config.enableBackup
|
||||
};
|
||||
|
||||
if ('mailboxName' in config) data.mailboxName = config.mailboxName;
|
||||
|
||||
post('/api/v1/apps/' + id + '/configure', data).success(function (data, status) {
|
||||
if (status !== 202) return callback(new ClientError(status, data));
|
||||
callback(null);
|
||||
|
||||
+4
-4
@@ -136,6 +136,10 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
|
||||
if (error) {
|
||||
if (error.statusCode === 409 && (error.message.indexOf('is reserved') !== -1 || error.message.indexOf('is already in use') !== -1)) {
|
||||
$scope.appConfigure.error.port = error.message;
|
||||
} else if (error.statusCode === 409 && error.message.indexOf('mailbox') !== -1 ) {
|
||||
$scope.appConfigure.error.mailboxName = error.message;
|
||||
$scope.appConfigureForm.mailboxName.$setPristine();
|
||||
$('#appConfigureMailboxNameInput').focus();
|
||||
} else if (error.statusCode === 409) {
|
||||
$scope.appConfigure.error.location = 'This name is already taken.';
|
||||
$scope.appConfigureForm.location.$setPristine();
|
||||
@@ -150,10 +154,6 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
|
||||
$scope.appConfigure.error.xFrameOptions = error.message;
|
||||
$scope.appConfigureForm.xFrameOptions.$setPristine();
|
||||
$('#appConfigureXFrameOptionsInput').focus();
|
||||
} else if (error.statusCode === 400 && error.message.indexOf('mailbox') !== -1 ) {
|
||||
$scope.appConfigure.error.mailboxName = error.message;
|
||||
$scope.appConfigureForm.mailboxName.$setPristine();
|
||||
$('#appConfigureMailboxNameInput').focus();
|
||||
} else {
|
||||
$scope.appConfigure.error.other = error.message;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user