From f83763918255f429263aa6e2fe3da1a39fbde689 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Mon, 23 Oct 2023 13:10:29 -0400 Subject: [PATCH] fix: add temp UserError --- lib/shared/config-manager/src/index.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/shared/config-manager/src/index.ts b/lib/shared/config-manager/src/index.ts index 5298ae7b0..617be268a 100644 --- a/lib/shared/config-manager/src/index.ts +++ b/lib/shared/config-manager/src/index.ts @@ -12,6 +12,14 @@ type ClearIntervalInterface = (intervalTimeout: any) => void type SetConfigBuffer = (sdkKey: string, projectConfig: string) => void +export class UserError extends Error { + constructor(error: Error | string) { + super(error instanceof Error ? error.message : error) + this.name = 'UserError' + this.stack = error instanceof Error ? error.stack : undefined + } +} + export class EnvironmentConfigManager { private readonly logger: DVCLogger private readonly sdkKey: string @@ -150,8 +158,7 @@ export class EnvironmentConfigManager { ) } else if (responseError?.status === 403) { this.stopPolling() - // UserError - throw new Error(`Invalid SDK key provided: ${this.sdkKey}`) + throw new UserError(`Invalid SDK key provided: ${this.sdkKey}`) } else { throw new Error('Failed to download DevCycle config.') }