From 9fe24b0fc8347a0265ddc700d0f90c9da0bf4349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Thu, 17 Mar 2022 12:42:32 +0100 Subject: [PATCH] catalog-backend: tell what entity failed validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/large-coins-arrive.md | 5 +++++ .../src/processing/DefaultCatalogProcessingOrchestrator.ts | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/large-coins-arrive.md diff --git a/.changeset/large-coins-arrive.md b/.changeset/large-coins-arrive.md new file mode 100644 index 0000000000000..3c0b3b9f97fdf --- /dev/null +++ b/.changeset/large-coins-arrive.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend': patch +--- + +Adjust the error messages when entities fail validation, to clearly state what entity that failed it diff --git a/plugins/catalog-backend/src/processing/DefaultCatalogProcessingOrchestrator.ts b/plugins/catalog-backend/src/processing/DefaultCatalogProcessingOrchestrator.ts index c050779a8bfd2..156503da8ec1a 100644 --- a/plugins/catalog-backend/src/processing/DefaultCatalogProcessingOrchestrator.ts +++ b/plugins/catalog-backend/src/processing/DefaultCatalogProcessingOrchestrator.ts @@ -241,7 +241,7 @@ export class DefaultCatalogProcessingOrchestrator validateEntity(entity); } catch (e) { throw new ConflictError( - `Entity envelope failed validation after preprocessing`, + `Entity envelope for ${context.entityRef} failed validation after preprocessing`, e, ); } @@ -262,7 +262,7 @@ export class DefaultCatalogProcessingOrchestrator } } catch (e) { throw new InputError( - `Processor ${processor.constructor.name} threw an error while validating the entity`, + `Processor ${processor.constructor.name} threw an error while validating the entity ${context.entityRef}`, e, ); } @@ -271,7 +271,7 @@ export class DefaultCatalogProcessingOrchestrator if (!foundKind) { throw new InputError( - 'No processor recognized the entity as valid, possibly caused by a foreign kind or apiVersion', + `No processor recognized the entity ${context.entityRef} as valid, possibly caused by a foreign kind or apiVersion`, ); } }