catalog-backend: throw correct error for not allowed entities

This commit is contained in:
Fredrik Adelöw
2021-02-01 10:17:42 +01:00
parent 435972704c
commit 24e47ef1e3
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Throw `NotAllowedError` when registering locations with entities of disallowed kinds
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { UrlReader } from '@backstage/backend-common';
import { NotAllowedError, UrlReader } from '@backstage/backend-common';
import {
Entity,
EntityPolicy,
@@ -102,7 +102,7 @@ export class LocationReaders implements LocationReader {
} else {
output.errors.push({
location: item.location,
error: new Error(
error: new NotAllowedError(
`Entity of kind ${item.entity.kind} is not allowed from location ${item.location.type} ${item.location.target}`,
),
});