Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions packages/client/lib/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BasicAuth, CredentialsError, CredentialsProvider, StreamingCredentialsP
import RedisCommandsQueue, { CommandOptions } from './commands-queue';
import { EventEmitter } from 'node:events';
import { attachConfig, functionArgumentsPrefix, getTransformReply, scriptArgumentsPrefix } from '../commander';
import { ClientClosedError, ClientOfflineError, DisconnectsClientError, SimpleError, WatchError } from '../errors';
import { ClientClosedError, ClientOfflineError, DisconnectsClientError, WatchError } from '../errors';
import { URL } from 'node:url';
import { TcpSocketConnectOpts } from 'node:net';
import { PUBSUB_TYPE, PubSubType, PubSubListener, PubSubTypeListeners, ChannelListeners } from './pub-sub';
Expand Down Expand Up @@ -626,14 +626,10 @@ export default class RedisClient<
if (!this.#options?.disableClientInfo) {
commands.push({
cmd: ['CLIENT', 'SETINFO', 'LIB-VER', version],
errorHandler: (err: Error) => {
// Only throw if not a SimpleError - unknown subcommand
// Client libraries are expected to ignore failures
// of type SimpleError - unknown subcommand, which are
// expected from older servers ( < v7 )
if (!(err instanceof SimpleError) || !err.isUnknownSubcommand()) {
throw err;
}
errorHandler: () => {
// Client libraries are expected to pipeline this command
// after authentication on all connections and ignore failures
// since they could be connected to an older version that doesn't support them.
}
});

Expand All @@ -646,14 +642,10 @@ export default class RedisClient<
? `node-redis(${this.#options.clientInfoTag})`
: 'node-redis'
],
errorHandler: (err: Error) => {
// Only throw if not a SimpleError - unknown subcommand
// Client libraries are expected to ignore failures
// of type SimpleError - unknown subcommand, which are
// expected from older servers ( < v7 )
if (!(err instanceof SimpleError) || !err.isUnknownSubcommand()) {
throw err;
}
errorHandler: () => {
// Client libraries are expected to pipeline this command
// after authentication on all connections and ignore failures
// since they could be connected to an older version that doesn't support them.
}
});
}
Expand Down
6 changes: 1 addition & 5 deletions packages/client/lib/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ export class ErrorReply extends Error {
}
}

export class SimpleError extends ErrorReply {
isUnknownSubcommand(): boolean {
return this.message.toLowerCase().indexOf('err unknown subcommand') !== -1;
}
}
export class SimpleError extends ErrorReply {}

export class BlobError extends ErrorReply {}

Expand Down
Loading