Improve error message for duplicate package policies (#126170)

This commit is contained in:
Kyle Pollich 2022-02-22 13:08:43 -05:00 committed by GitHub
parent 6f1a963d1d
commit 2b8b331271
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -115,7 +115,7 @@ class PackagePolicyService {
// Check that the name does not exist already
if (existingPoliciesWithName.items.length > 0) {
throw new IngestManagerError(
`There is already an integration policy with the same name: ${packagePolicy.name}`
`An integration policy with the name ${packagePolicy.name} already exists. Please rename it or choose a different name.`
);
}
}
@ -389,7 +389,9 @@ class PackagePolicyService {
const filtered = (existingPoliciesWithName?.items || []).filter((p) => p.id !== id);
if (filtered.length > 0) {
throw new IngestManagerError('There is already an integration policy with the same name');
throw new IngestManagerError(
`An integration policy with the name ${packagePolicy.name} already exists. Please rename it or choose a different name.`
);
}
let inputs = restOfPackagePolicy.inputs.map((input) =>