@@ -3,7 +3,7 @@ import testUtils, { GLOBAL, waitTillBeenCalled } from '../test-utils';
33import RedisClient , { RedisClientType } from '.' ;
44// import { RedisClientMultiCommandType } from './multi-command';
55// import { RedisCommandRawReply, RedisModules, RedisFunctions, RedisScripts } from '../commands';
6- import { AbortError , ClientClosedError , ClientOfflineError , ConnectionTimeoutError , DisconnectsClientError , SocketClosedUnexpectedlyError , WatchError } from '../errors' ;
6+ import { AbortError , ClientClosedError , ClientOfflineError , ConnectionTimeoutError , DisconnectsClientError , ErrorReply , MultiErrorReply , SocketClosedUnexpectedlyError , WatchError } from '../errors' ;
77import { defineScript } from '../lua-script' ;
88import { spy } from 'sinon' ;
99import { once } from 'node:events' ;
@@ -282,6 +282,23 @@ describe('Client', () => {
282282 // ...GLOBAL.SERVERS.OPEN,
283283 // minimumDockerVersion: [6, 2] // CLIENT INFO
284284 // });
285+
286+
287+ testUtils . testWithClient ( 'should handle error replies (#2665)' , async client => {
288+ await assert . rejects (
289+ client . multi ( )
290+ . set ( 'key' , 'value' )
291+ . hGetAll ( 'key' )
292+ . exec ( ) ,
293+ err => {
294+ assert . ok ( err instanceof MultiErrorReply ) ;
295+ assert . equal ( err . replies . length , 2 ) ;
296+ assert . deepEqual ( err . errorIndexes , [ 1 ] ) ;
297+ assert . ok ( err . replies [ 1 ] instanceof ErrorReply ) ;
298+ return true ;
299+ }
300+ ) ;
301+ } , GLOBAL . SERVERS . OPEN ) ;
285302 } ) ;
286303
287304 testUtils . testWithClient ( 'scripts' , async client => {
0 commit comments