diff --git a/.changeset/tough-clocks-enjoy.md b/.changeset/tough-clocks-enjoy.md new file mode 100644 index 0000000000..90e00382df --- /dev/null +++ b/.changeset/tough-clocks-enjoy.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend': patch +--- + +Tweaked the wording of the "does not have a location" errors to include the actual missing annotation name, to help users better in fixing their inputs. diff --git a/plugins/catalog-backend/src/processing/util.ts b/plugins/catalog-backend/src/processing/util.ts index 5cf7821371..94634f794a 100644 --- a/plugins/catalog-backend/src/processing/util.ts +++ b/plugins/catalog-backend/src/processing/util.ts @@ -37,7 +37,9 @@ export function getEntityLocationRef(entity: Entity): string { const ref = entity.metadata.annotations?.[ANNOTATION_LOCATION]; if (!ref) { const entityRef = stringifyEntityRef(entity); - throw new InputError(`Entity '${entityRef}' does not have a location`); + throw new InputError( + `Entity '${entityRef}' does not have the annotation ${ANNOTATION_LOCATION}`, + ); } return ref; } @@ -47,7 +49,7 @@ export function getEntityOriginLocationRef(entity: Entity): string { if (!ref) { const entityRef = stringifyEntityRef(entity); throw new InputError( - `Entity '${entityRef}' does not have an origin location`, + `Entity '${entityRef}' does not have the annotation ${ANNOTATION_ORIGIN_LOCATION}`, ); } return ref;