2023-11-08 00:24:07 +00:00
|
|
|
use dioxus::{core::CapturedError, prelude::*};
|
2022-03-08 19:15:18 +00:00
|
|
|
|
|
|
|
fn main() {
|
2023-09-15 14:13:36 +00:00
|
|
|
dioxus_desktop::launch(App);
|
2022-03-08 19:15:18 +00:00
|
|
|
}
|
|
|
|
|
2023-09-15 14:13:36 +00:00
|
|
|
#[component]
|
|
|
|
fn App(cx: Scope) -> Element {
|
2022-03-08 19:15:18 +00:00
|
|
|
cx.render(rsx! {
|
2023-11-08 00:24:07 +00:00
|
|
|
ErrorBoundary {
|
|
|
|
handle_error: |error: CapturedError| rsx! {"Found error {error}"},
|
|
|
|
DemoC {
|
|
|
|
x: 1
|
|
|
|
}
|
2022-03-08 19:15:18 +00:00
|
|
|
}
|
2022-11-16 09:13:39 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-09-15 14:13:36 +00:00
|
|
|
#[component]
|
|
|
|
fn DemoC(cx: Scope, x: i32) -> Element {
|
2023-11-08 00:24:07 +00:00
|
|
|
let result = Err("Error");
|
|
|
|
|
|
|
|
result.throw()?;
|
|
|
|
|
2022-11-16 09:13:39 +00:00
|
|
|
cx.render(rsx! {
|
|
|
|
h1 {
|
2023-11-08 00:24:07 +00:00
|
|
|
"{x}"
|
2022-11-16 09:13:39 +00:00
|
|
|
}
|
2022-03-08 19:15:18 +00:00
|
|
|
})
|
|
|
|
}
|