1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00

do not hide bugs in redis

This commit is contained in:
leibale
2021-07-20 13:39:35 -04:00
parent 8b4537ef0c
commit e7bf09644b
2 changed files with 10 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
import { GeoSearchFrom, GeoSearchBy, GeoSearchOptions, pushGeoSearchArguments, transformReplyNumber } from './generic-transformers';
import { GeoSearchFrom, GeoSearchBy, GeoSearchOptions, pushGeoSearchArguments } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
@@ -30,11 +30,10 @@ export function transformArguments(
return args;
}
export function transformReply(reply: number): number {
if (typeof reply !== 'number') {
throw new TypeError(`https://github.com/redis/redis/issues/9261`);
}
// in versions 6.2.0-6.2.4 Redis will return an empty array when `src` is empty
// TODO: issue/PR
export function transformReply(reply: number | []): number {
if (typeof reply === 'number') return reply;
return 0;
return reply;
}

View File

@@ -46,10 +46,10 @@ export function transformArguments(dst: string, src: string, min: number, max: n
return args;
}
// in versions 6.2.0-6.2.4 Redis will return an empty array when `src` is empty
// https://github.com/redis/redis/pull/9089
export function transformReply(reply: number | []): number {
if (typeof reply === 'number') return reply;
export function transformReply(reply: number): number {
if (typeof reply !== 'number') {
throw new TypeError(`Upgrade to Redis 6.2.5 and up (https://github.com/redis/redis/pull/9089)`);
};
return 0;
}