Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 08d5bb4

Browse files
committed
chore(refactor): make TimeoutError less stringly typed for util name
1 parent 2bd7222 commit 08d5bb4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎src/asyncUtils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ export interface WaitOptions {
77
}
88

99
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.`)
1212
}
1313
}
1414

@@ -27,7 +27,7 @@ function asyncUtils(addResolver: (callback: () => void) => void) {
2727
let timeoutId: ReturnType<typeof setTimeout>
2828
if (timeout && timeout > 0) {
2929
timeoutId = setTimeout(
30-
() => reject(new TimeoutError('waitForNextUpdate', timeout)),
30+
() => reject(new TimeoutError(waitForNextUpdate, timeout)),
3131
timeout
3232
)
3333
}
@@ -74,7 +74,7 @@ function asyncUtils(addResolver: (callback: () => void) => void) {
7474
}
7575
} catch (error: unknown) {
7676
if (error instanceof TimeoutError && initialTimeout) {
77-
throw new TimeoutError('waitFor', initialTimeout)
77+
throw new TimeoutError(waitFor, initialTimeout)
7878
}
7979
throw error as Error
8080
}
@@ -96,7 +96,7 @@ function asyncUtils(addResolver: (callback: () => void) => void) {
9696
})
9797
} catch (error: unknown) {
9898
if (error instanceof TimeoutError && options.timeout) {
99-
throw new TimeoutError('waitForValueToChange', options.timeout)
99+
throw new TimeoutError(waitForValueToChange, options.timeout)
100100
}
101101
throw error as Error
102102
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /