MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / catch_panic_async

Function catch_panic_async

src/ore/tests/future.rs:27–45  ·  view source on GitHub ↗

allow(test-attribute)

()

Source from the content-addressed store, hash-verified

25
26#[tokio::test] // allow(test-attribute)
27async fn catch_panic_async() {
28 let old_hook = panic::take_hook();
29 defer! {
30 panic::set_hook(old_hook);
31 }
32
33 install_enhanced_handler();
34
35 let result = async {
36 panic!("panicked");
37 }
38 .ore_catch_unwind()
39 .await
40 .unwrap_err()
41 .downcast::<&str>()
42 .unwrap();
43
44 assert_eq!(*result, "panicked");
45}

Callers

nothing calls this directly

Calls 3

install_enhanced_handlerFunction · 0.85
unwrapMethod · 0.80
ore_catch_unwindMethod · 0.80

Tested by

no test coverage detected