do not use field inside error object

This commit is contained in:
Girish Ramakrishnan
2022-02-07 13:44:26 -08:00
parent f4c9d7324b
commit 9ae69bb683
2 changed files with 9 additions and 7 deletions

View File

@@ -451,17 +451,19 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
Client.configureApp($scope.app.id, 'location', data, function (error) {
if (error && (error.statusCode === 409 || error.statusCode === 400)) {
if ((error.subdomain && error.domain) || error.field === 'location') {
if (data.domain === error.domain && data.subdomain === error.subdomain) { // the primary
if (error.message.indexOf('location') !== -1) {
if (error.message.indexOf('primary') !== -1) {
$scope.location.error.location = error.message;
$scope.locationForm.$setPristine();
} else { // FIXME: check error in aliasDomains
} else if (error.message.indexOf('secondary') !== -1) {
$scope.location.error.secondaryDomain = error.message;
} else if (error.message.indexOf('redirect') !== -1) {
$scope.location.error.redirectDomains = error.message;
} else if (error.message.indexOf('alias') !== -1) {
$scope.location.error.aliasDomains = error.message;
}
} else if (error.portName || error.field === 'portBindings') {
} else if (error.message.indexOf('portBinding') !== -1) {
$scope.location.error.port = error.message;
} else if (error.message.indexOf('secondaryDomain') !== -1) {
$scope.location.error.secondaryDomain = error.message;
}
$scope.location.busy = false;