unwind panics into error boundaries
This commit is contained in:
1 parent
34956cdb31
commit
2e7b8cb178
4 files changed
+69
-23
No files matched your search
@@ -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")
|
||||
}
|
||||
Reference in new issue
Block a user