From 75941ca364c30f66c1b177ff9f46099c1604b5d5 Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Fri, 12 Mar 2021 11:30:00 +0100 Subject: [PATCH] techdocs: techdocs_metadata.json could be missing, ignore the error Signed-off-by: Himanshu Mishra --- .../src/DocsBuilder/builder.ts | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/plugins/techdocs-backend/src/DocsBuilder/builder.ts b/plugins/techdocs-backend/src/DocsBuilder/builder.ts index 8c632fc6b0..5d8ee3612d 100644 --- a/plugins/techdocs-backend/src/DocsBuilder/builder.ts +++ b/plugins/techdocs-backend/src/DocsBuilder/builder.ts @@ -89,13 +89,21 @@ export class DocsBuilder { // check if docs are outdated and need to be regenerated. let storedEtag: string | undefined; if (await this.publisher.hasDocsBeenGenerated(this.entity)) { - storedEtag = ( - await this.publisher.fetchTechDocsMetadata({ - namespace: this.entity.metadata.namespace ?? ENTITY_DEFAULT_NAMESPACE, - kind: this.entity.kind, - name: this.entity.metadata.name, - }) - ).etag; + try { + storedEtag = ( + await this.publisher.fetchTechDocsMetadata({ + namespace: + this.entity.metadata.namespace ?? ENTITY_DEFAULT_NAMESPACE, + kind: this.entity.kind, + name: this.entity.metadata.name, + }) + ).etag; + } catch (err) { + // Proceed with a fresh build + this.logger.warn( + `Unable to read techdocs_metadata.json, error ${err}.`, + ); + } } let preparedDir: string;