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
@@ -1,4 +1,8 @@
|
||||
use crate::{nodes::RenderReturn, ComponentFunction};
|
||||
use crate::{
|
||||
innerlude::{throw_error, CapturedPanic},
|
||||
nodes::RenderReturn,
|
||||
ComponentFunction,
|
||||
};
|
||||
use std::{any::Any, panic::AssertUnwindSafe};
|
||||
|
||||
pub(crate) type BoxedAnyProps = Box<dyn AnyProps>;
|
||||
@@ -79,6 +83,7 @@ impl<F: ComponentFunction<P, M> + Clone, P: Clone + 'static, M: 'static> AnyProp
|
||||
Err(err) => {
|
||||
let component_name = self.name;
|
||||
tracing::error!("Error while rendering component `{component_name}`: {err:?}");
|
||||
throw_error::<()>(CapturedPanic { error: err });
|
||||
RenderReturn::default()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user