Throw error object and not a string

This commit is contained in:
Girish Ramakrishnan
2020-03-03 11:07:56 -08:00
parent 3cb15f0097
commit fb5e2ef671
2 changed files with 4 additions and 4 deletions

View File

@@ -167,10 +167,10 @@ app.controller('SetupDNSController', ['$scope', '$http', '$timeout', 'Client', f
};
if (!config.projectId || !config.credentials || !config.credentials.client_email || !config.credentials.private_key) {
throw 'fields_missing';
throw new Error('One or more fields are missing in the JSON');
}
} catch(e) {
$scope.error.dnsCredentials = 'Cannot parse Google Service Account Key';
} catch (e) {
$scope.error.dnsCredentials = 'Cannot parse Google Service Account Key: ' + e.message;
$scope.dnsCredentials.busy = false;
return;
}