Function freya::prelude::throw_error
pub fn throw_error(error: impl Into<CapturedError> + 'static)
Expand description
Throw a [CapturedError
] into the current scope. The error will bubble up to the nearest crate::prelude::ErrorBoundary()
or the root of the app.
§Examples
fn Component() -> Element {
let request = spawn(async move {
match reqwest::get("https://api.example.com").await {
Ok(_) => todo!(),
// You can explicitly throw an error into a scope with throw_error
Err(err) => ScopeId::APP.throw_error(err)
}
});
todo!()
}