From 5662fa14f8f78719f8542984b4520b50902ef18a Mon Sep 17 00:00:00 2001 From: John Konecny <24961694+jfkonecn@users.noreply.github.com> Date: Thu, 3 Oct 2024 13:33:02 -0400 Subject: [PATCH] Make core API call non-blocking --- .../firebase/firebase-gene-review-service.ts | 27 ++++++++++++++++--- src/main/webapp/app/shared/feature-flags.ts | 1 + 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 src/main/webapp/app/shared/feature-flags.ts diff --git a/src/main/webapp/app/service/firebase/firebase-gene-review-service.ts b/src/main/webapp/app/service/firebase/firebase-gene-review-service.ts index ce9ecb03..37575df1 100644 --- a/src/main/webapp/app/service/firebase/firebase-gene-review-service.ts +++ b/src/main/webapp/app/service/firebase/firebase-gene-review-service.ts @@ -36,6 +36,8 @@ import { EvidenceApi } from 'app/shared/api/manual/evidence-api'; import { createGeneTypePayload, isGeneTypeChange } from 'app/shared/util/core-gene-type-submission/core-gene-type-submission'; import { GeneTypeApi } from 'app/shared/api/manual/gene-type-api'; import { flattenReviewPaths, useLastReviewedOnly } from 'app/shared/util/core-submission-shared/core-submission-utils'; +import { notifyError } from 'app/oncokb-commons/components/util/NotificationUtils'; +import { STOP_REVIEW_IF_CORE_SUBMISSION_FAILS } from 'app/shared/feature-flags'; export class FirebaseGeneReviewService { firebaseRepository: FirebaseRepository; @@ -180,7 +182,16 @@ export class FirebaseGeneReviewService { } } } catch (error) { - throw new SentryError('Failed to create evidences when accepting changes in review mode', { hugoSymbol, reviewLevels, isGermline }); + const sentryError = new SentryError('Failed to create evidences when accepting changes in review mode', { + hugoSymbol, + reviewLevels, + isGermline, + }); + if (STOP_REVIEW_IF_CORE_SUBMISSION_FAILS) { + throw sentryError; + } else { + console.error(sentryError); + } } try { @@ -188,11 +199,16 @@ export class FirebaseGeneReviewService { await this.geneTypeClient.submitGeneTypeToCore(geneTypePayload); } } catch (error) { - throw new SentryError('Failed to submit evidences to core when accepting changes in review mode', { + const sentryError = new SentryError('Failed to submit evidences to core when accepting changes in review mode', { hugoSymbol, reviewLevels, isGermline, }); + if (STOP_REVIEW_IF_CORE_SUBMISSION_FAILS) { + throw sentryError; + } else { + console.error(sentryError); + } } try { @@ -200,11 +216,16 @@ export class FirebaseGeneReviewService { await this.evidenceClient.submitEvidences(evidences); } } catch (error) { - throw new SentryError('Failed to submit evidences to core when accepting changes in review mode', { + const sentryError = new SentryError('Failed to submit evidences to core when accepting changes in review mode', { hugoSymbol, reviewLevels, isGermline, }); + if (STOP_REVIEW_IF_CORE_SUBMISSION_FAILS) { + throw sentryError; + } else { + console.error(sentryError); + } } let updateObject = {}; diff --git a/src/main/webapp/app/shared/feature-flags.ts b/src/main/webapp/app/shared/feature-flags.ts new file mode 100644 index 00000000..d193c185 --- /dev/null +++ b/src/main/webapp/app/shared/feature-flags.ts @@ -0,0 +1 @@ +export const STOP_REVIEW_IF_CORE_SUBMISSION_FAILS: boolean = false;