unwind panics into error boundaries

This commit is contained in:
Evan Almloff committed 2024-03-13 18:55:57 -05:00
1 parent 34956cdb31
commit 2e7b8cb178
4 files changed
+69 -23

No files matched your search

+12
View File
@@ -20,6 +20,14 @@ fn app() -> Element {
},
DemoC { x: 1 }
}
ErrorBoundary {
handle_error: |error: CapturedError| rsx! {
h1 { "Another error occurred" }
pre { "{error:#?}" }
},
ComponentPanic {}
}
}
}
@@ -40,3 +48,7 @@ fn DemoC(x: i32) -> Element {
}
}
}
fn ComponentPanic() -> Element {
panic!("This component panics")
}