DioxusLabs / DioxusLabs/dioxus

What is replacement for `provide_error_boundary`?

Open
#4,749 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

currently I used `use_hook(provide_error_boundary)` to forward all errors globally into custom notification system instead of crash entire app or change any existing content but now it seem to not exists anymore.
```rust
let error_boundary = use_hook(provide_error_boundary);
let errors = error_boundary.errors();
let has_error = !errors.is_empty();
if has_error {
for error in errors.iter() {
noti.send_msg(NotificationType::Error, error.to_string())
}
}
drop(errors);
if has_error {
error_boundary.clear_errors();
}
```

I saw `use_error_boundary_provider` but it is only exists internally for `ErrorBoundary` but not re-export into prelude in `0.7.0-rc.1`.

something like this does not solve my issue because it replace content in current page
```rust
ErrorBoundary {
handle_error: move|error_boundary:ErrorContext| {
let errors = error_boundary.error();
let has_error = errors.is_some();
if has_error {
for error in errors.iter() {
noti.send_msg(NotificationType::Error, error.to_string())
}
}
drop(errors);
if has_error {
error_boundary.clear_errors();
}
rsx!()
},
AppBody { state }
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.