From c031bdfced3028402da8fa099ad57ee9a1b9772c Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Thu, 28 Nov 2024 18:16:39 -0800 Subject: [PATCH] improv: add error handling --- core/util/posthog.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/core/util/posthog.ts b/core/util/posthog.ts index d4a31b46d..dea92ec85 100644 --- a/core/util/posthog.ts +++ b/core/util/posthog.ts @@ -102,11 +102,15 @@ export class Telemetry { } static async getValueForFeatureFlag(flag: PosthogFeatureFlag) { - const userGroup = await Telemetry.getFeatureFlag(flag); - if (typeof userGroup === "string") { - return EXPERIMENTS[flag][userGroup].value; - } + try { + const userGroup = await Telemetry.getFeatureFlag(flag); + if (typeof userGroup === "string") { + return EXPERIMENTS[flag][userGroup].value; + } - return undefined; + return undefined; + } catch { + return undefined; + } } }