diff --git a/src/evaluator/index.ts b/src/evaluator/index.ts index 70dad68a..62f82e98 100644 --- a/src/evaluator/index.ts +++ b/src/evaluator/index.ts @@ -94,7 +94,7 @@ export function evaluateFeaturesByFlagSets( flagSets: string[], attributes: SplitIO.Attributes | undefined, storage: IStorageSync | IStorageAsync, -): MaybeThenable> { +): MaybeThenable> { let storedFlagNames: MaybeThenable>; // get features by flag sets @@ -107,7 +107,10 @@ export function evaluateFeaturesByFlagSets( // evaluate related features return thenable(storedFlagNames) ? - storedFlagNames.then((splitNames) => evaluateFeatures(log, key, setToArray(splitNames), attributes, storage)) : + storedFlagNames.then((splitNames) => evaluateFeatures(log, key, setToArray(splitNames), attributes, storage)) + .catch(() => { + return {}; + }) : evaluateFeatures(log, key, setToArray(storedFlagNames), attributes, storage); } diff --git a/src/storages/inRedis/SplitsCacheInRedis.ts b/src/storages/inRedis/SplitsCacheInRedis.ts index 310c014d..f58f49ab 100644 --- a/src/storages/inRedis/SplitsCacheInRedis.ts +++ b/src/storages/inRedis/SplitsCacheInRedis.ts @@ -5,7 +5,7 @@ import { ILogger } from '../../logger/types'; import { LOG_PREFIX } from './constants'; import { ISplit } from '../../dtos/types'; import { AbstractSplitsCacheAsync } from '../AbstractSplitsCacheAsync'; -import { ISet, _Set } from '../../utils/lang/sets'; +import { ISet } from '../../utils/lang/sets'; /** * Discard errors for an answer of multiple operations. @@ -196,8 +196,8 @@ export class SplitsCacheInRedis extends AbstractSplitsCacheAsync { * @todo this is a no-op method to be implemented */ getNamesByFlagSets(): Promise> { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - return new Promise(flagSets => new _Set([])); + this.log.error(LOG_PREFIX + 'ByFlagSet/s evaluations are not supported with Redis storage yet.'); + return Promise.reject(); } /** diff --git a/src/storages/pluggable/SplitsCachePluggable.ts b/src/storages/pluggable/SplitsCachePluggable.ts index c6dce829..786fb8a5 100644 --- a/src/storages/pluggable/SplitsCachePluggable.ts +++ b/src/storages/pluggable/SplitsCachePluggable.ts @@ -5,7 +5,7 @@ import { ILogger } from '../../logger/types'; import { ISplit } from '../../dtos/types'; import { LOG_PREFIX } from './constants'; import { AbstractSplitsCacheAsync } from '../AbstractSplitsCacheAsync'; -import { ISet, _Set } from '../../utils/lang/sets'; +import { ISet } from '../../utils/lang/sets'; /** * ISplitsCacheAsync implementation for pluggable storages. @@ -162,8 +162,8 @@ export class SplitsCachePluggable extends AbstractSplitsCacheAsync { * @todo this is a no-op method to be implemented */ getNamesByFlagSets(): Promise> { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - return new Promise(flagSets => new _Set([])); + this.log.error(LOG_PREFIX + 'ByFlagSet/s evaluations are not supported with pluggable storage yet.'); + return Promise.reject(); } /**