Skip to content

Commit

Permalink
catalog-backend: tell what entity failed validation
Browse files Browse the repository at this point in the history
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
  • Loading branch information
freben committed Mar 17, 2022
1 parent 8307218 commit 9fe24b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .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
Expand Up @@ -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,
);
}
Expand All @@ -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,
);
}
Expand All @@ -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`,
);
}
}
Expand Down

0 comments on commit 9fe24b0

Please sign in to comment.