Fix error display

This commit is contained in:
Girish Ramakrishnan
2022-02-07 16:11:57 -08:00
parent 9ae69bb683
commit 4fead2411e
2 changed files with 18 additions and 12 deletions

View File

@@ -450,20 +450,23 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
}
Client.configureApp($scope.app.id, 'location', data, function (error) {
var errorMessage = error.message.toLowerCase();
if (error && (error.statusCode === 409 || error.statusCode === 400)) {
if (error.message.indexOf('location') !== -1) {
if (error.message.indexOf('primary') !== -1) {
if (errorMessage.indexOf('location') !== -1) {
if (errorMessage.indexOf('primary') !== -1) {
$scope.location.error.location = error.message;
$scope.locationForm.$setPristine();
} else if (error.message.indexOf('secondary') !== -1) {
} else if (errorMessage.indexOf('secondary') !== -1) {
$scope.location.error.secondaryDomain = error.message;
} else if (error.message.indexOf('redirect') !== -1) {
} else if (errorMessage.indexOf('redirect') !== -1) {
$scope.location.error.redirectDomains = error.message;
} else if (error.message.indexOf('alias') !== -1) {
} else if (errorMessage.indexOf('alias') !== -1) {
$scope.location.error.aliasDomains = error.message;
}
} else if (error.message.indexOf('portBinding') !== -1) {
} else if (errorMessage.indexOf('port') !== -1) {
$scope.location.error.port = error.message;
} else {
$scope.location.error.location = error.message; // fallback
}
$scope.location.busy = false;
@@ -1573,10 +1576,11 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.clone.busy = false;
if (error) {
var errorMessage = error.message.toLowerCase();
if (error.statusCode === 409) {
if (error.portName) {
if (errorMessage.indexOf('port') !== -1) {
$scope.clone.error.port = error.message;
} else if (error.domain) {
} else if (error.message.indexOf('location') !== -1) {
$scope.clone.error.location = 'This location is already taken.';
$('#cloneLocationInput').focus();
} else {