move stuff around until it feels right
This commit is contained in:
10
helpers/reject-after.ts
Normal file
10
helpers/reject-after.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { setTimeout } from "node:timers/promises"
|
||||
import { toError } from "./to-error.js"
|
||||
|
||||
export async function rejectAfter(
|
||||
timeMs: number,
|
||||
error: unknown = `rejected after ${timeMs}ms`,
|
||||
): Promise<never> {
|
||||
await setTimeout(timeMs)
|
||||
return Promise.reject(toError(error))
|
||||
}
|
||||
Reference in New Issue
Block a user