Skip to content

Commit

Permalink
fix: add temp UserError
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathannorris committed Oct 23, 2023
1 parent 59a2f2e commit f837639
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/shared/config-manager/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.')
}
Expand Down

0 comments on commit f837639

Please sign in to comment.