Fix effect stack issue

This commit is contained in:
Jonathan Kelley committed 2024-01-15 20:45:59 -08:00
1 parent a32ae8b112
commit bb750f5336
6 files changed
+38 -31

No files matched your search

+4 -1
View File
@@ -27,7 +27,10 @@ pub fn try_consume_context<T: 'static + Clone>() -> Option<T> {
pub fn consume_context<T: 'static + Clone>() -> T {
with_current_scope(|cx| cx.consume_context::<T>())
.flatten()
.unwrap_or_else(|| panic!("Could not find context {}", std::any::type_name::<T>(),))
.expect(&format!(
"Could not find context {}",
std::any::type_name::<T>(),
))
}
/// Consume context from the current scope