Skip to content

Commit

Permalink
fix: move UserError to request lib
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathannorris committed Sep 29, 2023
1 parent a6099a2 commit 9c52d97
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
6 changes: 2 additions & 4 deletions lib/shared/config-manager/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { DVCLogger } from '@devcycle/types'
// import { UserError } from './utils/userError'
import { getEnvironmentConfig } from './request'
import { DevCycleOptions } from '@devcycle/js-cloud-server-sdk'
import { ResponseError } from '@devcycle/server-request'
import { ResponseError, UserError } from '@devcycle/server-request'

type ConfigPollingOptions = DevCycleOptions & {
cdnURI?: string
Expand Down Expand Up @@ -151,8 +150,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
2 changes: 2 additions & 0 deletions lib/shared/server-request/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import fetchWithRetry, { RequestInitWithRetry } from 'fetch-retry'

export * from './userError'

export class ResponseError extends Error {
constructor(message: string) {
super(message)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion sdk/nodejs/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
VariableTypeAlias,
} from '@devcycle/types'
import os from 'os'
import { UserError } from './utils/userError'
import {
DevCycleUser,
DVCVariable,
Expand All @@ -31,6 +30,7 @@ import {
DevCycleEvent,
} from '@devcycle/js-cloud-server-sdk'
import { DVCPopulatedUserFromDevCycleUser } from './models/populatedUserHelpers'
import { UserError } from '@devcycle/server-request'

interface IPlatformData {
platform: string
Expand Down

0 comments on commit 9c52d97

Please sign in to comment.