Merge pull request #10262 from backstage/freben/more-errors

catalog-backend: tell what entity failed validation
This commit is contained in:
Fredrik Adelöw
2022-03-17 13:48:32 +01:00
committed by GitHub
2 changed files with 8 additions and 3 deletions
+5
View File
@@ -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
@@ -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`,
);
}
}