From 029526ccf0b07bc3c205ed5e78a3fcd21ff9b800 Mon Sep 17 00:00:00 2001 From: Mike Haley Date: Mon, 30 Jun 2025 23:03:22 -0400 Subject: [PATCH] Fix parseReferenceAnnotation missing annotation error message Signed-off-by: Mike Haley --- .changeset/whole-buckets-fix.md | 5 +++++ plugins/techdocs-node/src/helpers.test.ts | 5 ++++- plugins/techdocs-node/src/helpers.ts | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .changeset/whole-buckets-fix.md diff --git a/.changeset/whole-buckets-fix.md b/.changeset/whole-buckets-fix.md new file mode 100644 index 0000000000..87097859f4 --- /dev/null +++ b/.changeset/whole-buckets-fix.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-techdocs-node': patch +--- + +Updated the error message thrown by parseReferenceAnnotation to reflect the annotation value passed as an argument rather than in correctly assuming location. diff --git a/plugins/techdocs-node/src/helpers.test.ts b/plugins/techdocs-node/src/helpers.test.ts index 33f4018f47..aa1aa69d30 100644 --- a/plugins/techdocs-node/src/helpers.test.ts +++ b/plugins/techdocs-node/src/helpers.test.ts @@ -113,9 +113,12 @@ describe('parseReferenceAnnotation', () => { }); it('should throw error without annotation', () => { + const logMsgRegex = new RegExp( + `No ${TECHDOCS_ANNOTATION} annotation provided`, + ); expect(() => { parseReferenceAnnotation(TECHDOCS_ANNOTATION, entityBase); - }).toThrow(/No location annotation/); + }).toThrow(logMsgRegex); }); it('should throw error with bad annotation', () => { diff --git a/plugins/techdocs-node/src/helpers.ts b/plugins/techdocs-node/src/helpers.ts index 67bb862c62..f1655aa9a6 100644 --- a/plugins/techdocs-node/src/helpers.ts +++ b/plugins/techdocs-node/src/helpers.ts @@ -52,7 +52,7 @@ export const parseReferenceAnnotation = ( const annotation = entity.metadata.annotations?.[annotationName]; if (!annotation) { throw new InputError( - `No location annotation provided in entity: ${entity.metadata.name}`, + `No ${annotationName} annotation provided in entity: ${entity.metadata.name}`, ); }