dioxus_lib::prelude

Function throw_error

source
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(_) => unimplemented!(),
            // You can explicitly throw an error into a scope with throw_error
            Err(err) => ScopeId::APP.throw_error(err)
        }
    });

    unimplemented!()
}