Change context api to panic with nice error message

This commit is contained in:
Jonathan Kelley committed 2024-01-15 18:02:58 -08:00
1 parent ee5020c41f
commit 14651a3573
19 files changed
+96 -69

No files matched your search

+2 -2
View File
@@ -1,5 +1,5 @@
use crate::{
global_context::{consume_context, current_scope_id},
global_context::{current_scope_id, try_consume_context},
innerlude::provide_context,
use_hook, Element, IntoDynNode, Properties, ScopeId, Template, TemplateAttribute, TemplateNode,
VNode,
@@ -202,7 +202,7 @@ pub trait Throw<S = ()>: Sized {
}
fn throw_error<T>(e: impl Debug + 'static) -> Option<T> {
if let Some(cx) = consume_context::<ErrorBoundary>() {
if let Some(cx) = try_consume_context::<ErrorBoundary>() {
match current_scope_id() {
Some(id) => cx.insert_error(id, Box::new(e), Backtrace::capture()),
None => {