File tree 3 files changed +43
-7
lines changed
3 files changed +43
-7
lines changed Original file line number Diff line number Diff line change
1
+ import { cronometro } from "cronometro" ;
2
+ import Redis from "../lib/redis" ;
3
+
4
+ let redis ;
5
+
6
+ cronometro (
7
+ {
8
+ default : {
9
+ test ( ) {
10
+ return redis . set ( "foo" , "bar" ) ;
11
+ } ,
12
+ before ( cb ) {
13
+ redis = new Redis ( ) ;
14
+ cb ( ) ;
15
+ } ,
16
+ after ( cb ) {
17
+ redis . quit ( ) ;
18
+ cb ( ) ;
19
+ } ,
20
+ } ,
21
+ "showFriendlyErrorStack=true" : {
22
+ test ( ) {
23
+ return redis . set ( "foo" , "bar" ) ;
24
+ } ,
25
+ before ( cb ) {
26
+ redis = new Redis ( { showFriendlyErrorStack : true } ) ;
27
+ cb ( ) ;
28
+ } ,
29
+ after ( cb ) {
30
+ redis . quit ( ) ;
31
+ cb ( ) ;
32
+ } ,
33
+ } ,
34
+ } ,
35
+ {
36
+ print : { compare : true } ,
37
+ }
38
+ ) ;
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ interface ICommandOptions {
20
20
* @memberof ICommandOptions
21
21
*/
22
22
replyEncoding ?: string | null ;
23
- errorStack ?: string ;
23
+ errorStack ?: Error ;
24
24
keyPrefix ?: string ;
25
25
/**
26
26
* Force the command to be readOnly so it will also execute on slaves
@@ -149,7 +149,7 @@ export default class Command implements ICommand {
149
149
public isReadOnly ?: boolean ;
150
150
151
151
private replyEncoding : string | null ;
152
- private errorStack : string ;
152
+ private errorStack : Error ;
153
153
public args : CommandParameter [ ] ;
154
154
private callback : CallbackFunction ;
155
155
private transformed = false ;
@@ -215,7 +215,7 @@ export default class Command implements ICommand {
215
215
this . resolve = this . _convertValue ( resolve ) ;
216
216
if ( this . errorStack ) {
217
217
this . reject = ( err ) => {
218
- reject ( optimizeErrorStack ( err , this . errorStack , __dirname ) ) ;
218
+ reject ( optimizeErrorStack ( err , this . errorStack . stack , __dirname ) ) ;
219
219
} ;
220
220
} else {
221
221
this . reject = reject ;
Original file line number Diff line number Diff line change @@ -160,9 +160,7 @@ function generateFunction(
160
160
}
161
161
162
162
const options = {
163
- errorStack : this . options . showFriendlyErrorStack
164
- ? new Error ( ) . stack
165
- : undefined ,
163
+ errorStack : this . options . showFriendlyErrorStack ? new Error ( ) : undefined ,
166
164
keyPrefix : this . options . keyPrefix ,
167
165
replyEncoding : _encoding ,
168
166
} ;
@@ -226,7 +224,7 @@ function generateScriptingFunction(
226
224
}
227
225
228
226
if ( this . options . showFriendlyErrorStack ) {
229
- options . errorStack = new Error ( ) . stack ;
227
+ options . errorStack = new Error ( ) ;
230
228
}
231
229
232
230
// No auto pipeline, use regular command sending
You can’t perform that action at this time.
0 commit comments