Fix parseReferenceAnnotation missing annotation error message

Signed-off-by: Mike Haley <mike.f.haley@gmail.com>
This commit is contained in:
Mike Haley
2025-06-30 23:03:22 -04:00
parent 722cc99c00
commit 029526ccf0
3 changed files with 10 additions and 2 deletions
+5
View File
@@ -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.
+4 -1
View File
@@ -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', () => {
+1 -1
View File
@@ -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}`,
);
}