From 37b33fba2d92dd183eccc995e6706133476bcbf7 Mon Sep 17 00:00:00 2001 From: Yusinto Ngadiman Date: Tue, 19 Sep 2023 12:14:45 -0700 Subject: [PATCH] chore: fixed conflicts --- packages/shared/common/src/errors.ts | 5 ++++- packages/shared/sdk-server/src/LDClientImpl.ts | 3 ++- .../shared/sdk-server/src/data_sources/PollingProcessor.ts | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/shared/common/src/errors.ts b/packages/shared/common/src/errors.ts index 4a805c875..eb7be712e 100644 --- a/packages/shared/common/src/errors.ts +++ b/packages/shared/common/src/errors.ts @@ -10,8 +10,11 @@ export class LDFileDataSourceError extends Error { } export class LDPollingError extends Error { - constructor(message: string) { + public readonly status?: number; + + constructor(message: string, status?: number) { super(message); + this.status = status; this.name = 'LaunchDarklyPollingError'; } } diff --git a/packages/shared/sdk-server/src/LDClientImpl.ts b/packages/shared/sdk-server/src/LDClientImpl.ts index 0cf9b59b6..3af734be6 100644 --- a/packages/shared/sdk-server/src/LDClientImpl.ts +++ b/packages/shared/sdk-server/src/LDClientImpl.ts @@ -15,7 +15,7 @@ import { subsystem, } from '@launchdarkly/js-sdk-common'; -import { LDClient, LDFlagsState, LDFlagsStateOptions, LDOptions } from './api'; +import { LDClient, LDFeatureStore, LDFlagsState, LDFlagsStateOptions, LDOptions } from './api'; import { BigSegmentStoreMembership } from './api/interfaces'; import BigSegmentsManager from './BigSegmentsManager'; import BigSegmentStoreStatusProvider from './BigSegmentStatusProviderImpl'; @@ -40,6 +40,7 @@ import Configuration from './options/Configuration'; import { AsyncStoreFacade } from './store'; import VersionedDataKinds from './store/VersionedDataKinds'; +const { NullEventProcessor } = internal; enum InitState { Initializing, Initialized, diff --git a/packages/shared/sdk-server/src/data_sources/PollingProcessor.ts b/packages/shared/sdk-server/src/data_sources/PollingProcessor.ts index fbf7502e6..a51beee7c 100644 --- a/packages/shared/sdk-server/src/data_sources/PollingProcessor.ts +++ b/packages/shared/sdk-server/src/data_sources/PollingProcessor.ts @@ -57,10 +57,11 @@ export default class PollingProcessor implements subsystem.LDStreamProcessor { this.logger?.debug('Elapsed: %d ms, sleeping for %d ms', elapsed, sleepFor); if (err) { - if (err.status && !isHttpRecoverable(err.status)) { + const { status } = err; + if (status && !isHttpRecoverable(status)) { const message = httpErrorMessage(err, 'polling request'); this.logger?.error(message); - this.errorHandler?.(new LDPollingError(message)); + this.errorHandler?.(new LDPollingError(message, status)); // It is not recoverable, return and do not trigger another // poll. return;