Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F995781
assert-throws-async.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
444 B
Referenced Files
None
Subscribers
None
assert-throws-async.ts
View Options
/* 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
Details
Attached
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)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment