@@ -7,8 +7,8 @@ export interface WaitOptions {
7
7
}
8
8
9
9
class TimeoutError extends Error {
10
- constructor ( utilName : string , timeout : number ) {
11
- super ( `Timed out in ${ utilName } after ${ timeout } ms.` )
10
+ constructor ( util : Function , timeout : number ) {
11
+ super ( `Timed out in ${ util . name } after ${ timeout } ms.` )
12
12
}
13
13
}
14
14
@@ -27,7 +27,7 @@ function asyncUtils(addResolver: (callback: () => void) => void) {
27
27
let timeoutId : ReturnType < typeof setTimeout >
28
28
if ( timeout && timeout > 0 ) {
29
29
timeoutId = setTimeout (
30
- ( ) => reject ( new TimeoutError ( ' waitForNextUpdate' , timeout ) ) ,
30
+ ( ) => reject ( new TimeoutError ( waitForNextUpdate , timeout ) ) ,
31
31
timeout
32
32
)
33
33
}
@@ -74,7 +74,7 @@ function asyncUtils(addResolver: (callback: () => void) => void) {
74
74
}
75
75
} catch ( error : unknown ) {
76
76
if ( error instanceof TimeoutError && initialTimeout ) {
77
- throw new TimeoutError ( ' waitFor' , initialTimeout )
77
+ throw new TimeoutError ( waitFor , initialTimeout )
78
78
}
79
79
throw error as Error
80
80
}
@@ -96,7 +96,7 @@ function asyncUtils(addResolver: (callback: () => void) => void) {
96
96
} )
97
97
} catch ( error : unknown ) {
98
98
if ( error instanceof TimeoutError && options . timeout ) {
99
- throw new TimeoutError ( ' waitForValueToChange' , options . timeout )
99
+ throw new TimeoutError ( waitForValueToChange , options . timeout )
100
100
}
101
101
throw error as Error
102
102
}
0 commit comments