Page MenuHomeSealhub

assert-throws-async.ts
No OneTemporary

assert-throws-async.ts

/* eslint-disable @typescript-eslint/no-explicit-any */
import assert from "assert";
export async function assertThrowsAsync(
fn: () => Promise<unknown>,
error_handler?: (e: any) => Promise<void> | void
): Promise<void> {
let error: unknown = null;
try {
await fn();
} catch (e: unknown) {
error = e;
} finally {
assert.notStrictEqual(error, null, "It didn't throw");
if (error_handler) {
await error_handler(error);
}
}
}

File Metadata

Mime Type
text/x-java
Expires
Mon, Dec 23, 17:54 (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
556379
Default Alt Text
assert-throws-async.ts (444 B)

Event Timeline