Fix error handling

This commit is contained in:
Girish Ramakrishnan
2018-05-24 20:15:08 -07:00
parent ed1320c937
commit e92cfae4d9
2 changed files with 6 additions and 4 deletions
+2
View File
@@ -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
View File
@@ -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;
}