diff --git a/.changeset/proud-birds-worry.md b/.changeset/proud-birds-worry.md new file mode 100644 index 0000000000..cef7120fe1 --- /dev/null +++ b/.changeset/proud-birds-worry.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-tech-insights-backend': patch +--- + +Complete check results run when a single check errors so that we don't block other checks from working due to an error in a single check diff --git a/plugins/tech-insights-backend/src/service/router.ts b/plugins/tech-insights-backend/src/service/router.ts index 6dba290422..5e58df1b20 100644 --- a/plugins/tech-insights-backend/src/service/router.ts +++ b/plugins/tech-insights-backend/src/service/router.ts @@ -32,6 +32,7 @@ import { stringifyEntityRef, } from '@backstage/catalog-model'; import { errorHandler } from '@backstage/backend-common'; +import { serializeError } from '@backstage/errors'; /** * @public @@ -106,11 +107,21 @@ export async function createRouter< const tasks = entities.map(async entity => { const entityTriplet = typeof entity === 'string' ? entity : stringifyEntityRef(entity); - const results = await factChecker.runChecks(entityTriplet, checks); - return { - entity: entityTriplet, - results, - }; + try { + const results = await factChecker.runChecks(entityTriplet, checks); + return { + entity: entityTriplet, + results, + }; + } catch (e: any) { + const error = serializeError(e); + logger.error(`${error.name}: ${error.message}`); + return { + entity: entityTriplet, + error: error, + results: [], + }; + } }); const results = await Promise.all(tasks); return res.json(results);