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

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;
}