From a76aec12d419c91068011b01e6dab50606927a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 17 Feb 2020 07:39:53 +0100 Subject: [PATCH] Catch Promise.reject to avoid uncaught rejection [ci skip] --- .../timeline/cells/wp-timeline-cell.ts | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/frontend/src/app/components/wp-table/timeline/cells/wp-timeline-cell.ts b/frontend/src/app/components/wp-table/timeline/cells/wp-timeline-cell.ts index 672ed14afd..53536521ae 100644 --- a/frontend/src/app/components/wp-table/timeline/cells/wp-timeline-cell.ts +++ b/frontend/src/app/components/wp-table/timeline/cells/wp-timeline-cell.ts @@ -133,7 +133,7 @@ export class WorkPackageTimelineCell { const cell = this.cellElement; if (!cell.length) { - return Promise.reject(); + return Promise.reject('uninitialized'); } const wasRendered = this.wpElement !== null && body.contains(this.wpElement); @@ -190,17 +190,19 @@ export class WorkPackageTimelineCell { const renderer = this.cellRenderer(renderInfo.workPackage); // Render initial element if necessary - this.lazyInit(renderer, renderInfo).then(() => { - // Render the upgrade from renderInfo - const shouldBeDisplayed = renderer.update( - this.wpElement as HTMLDivElement, - this.labels, - renderInfo); - - if (!shouldBeDisplayed) { - this.clear(); - } - }); + this.lazyInit(renderer, renderInfo) + .then(() => { + // Render the upgrade from renderInfo + const shouldBeDisplayed = renderer.update( + this.wpElement as HTMLDivElement, + this.labels, + renderInfo); + + if (!shouldBeDisplayed) { + this.clear(); + } + }) + .catch(() => null); } }