Skip to content

Commit d348297

Browse files
committed
fix: handle case where timeoutSeconds is NaN
1 parent e027119 commit d348297

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/v2/options.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,13 +369,18 @@ export interface EventHandlerOptions extends Omit<GlobalOptions, "enforceAppChec
369369
* @internal
370370
*/
371371
export function assertTimeoutSecondsValid(
372-
opts: GlobalOptions | EventHandlerOptions | HttpsOptions | undefined,
372+
opts: GlobalOptions | EventHandlerOptions | HttpsOptions,
373373
kind: TimeoutKind
374374
): void {
375375
const timeoutSeconds = opts?.timeoutSeconds ?? getGlobalOptions().timeoutSeconds;
376376
if (typeof timeoutSeconds !== "number") {
377377
return;
378378
}
379+
// Handle the case where timeoutSeconds is NaN
380+
if (!Number.isFinite(timeoutSeconds)) {
381+
throw new Error(`timeoutSeconds must be a finite number. Got ${timeoutSeconds}.`);
382+
}
383+
379384
let max: number;
380385
let label: string;
381386
switch (kind) {

0 commit comments

Comments
 (0)