chore: add info about entity if tech docs building fails

Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
This commit is contained in:
Heikki Hellgren
2023-10-19 14:27:22 +03:00
parent e5b6767025
commit c3c5c7e514
3 changed files with 14 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-techdocs-backend': patch
---
Add info about the entity when tech docs fail to build
@@ -258,7 +258,7 @@ describe('DocsSynchronizer', () => {
expect(mockResponseHandler.log).toHaveBeenCalledTimes(1);
expect(mockResponseHandler.log).toHaveBeenCalledWith(
expect.stringMatching(
/error.*: Failed to build the docs page: Some random error/,
/error.*: Failed to build the docs page for entity component:default\/test: Some random error/,
),
);
expect(mockResponseHandler.finish).toHaveBeenCalledTimes(0);
@@ -15,7 +15,11 @@
*/
import { PluginEndpointDiscovery } from '@backstage/backend-common';
import { Entity, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
import {
DEFAULT_NAMESPACE,
Entity,
stringifyEntityRef,
} from '@backstage/catalog-model';
import { Config } from '@backstage/config';
import { assertError, NotFoundError } from '@backstage/errors';
import { ScmIntegrationRegistry } from '@backstage/integration';
@@ -142,7 +146,9 @@ export class DocsSynchronizer {
}
} catch (e) {
assertError(e);
const msg = `Failed to build the docs page: ${e.message}`;
const msg = `Failed to build the docs page for entity ${stringifyEntityRef(
entity,
)}: ${e.message}`;
taskLogger.error(msg);
this.logger.error(msg, e);
error(e);