Better expect error messages (#2629)
* Replace expect error messages * Change message * Create RuntimeError struct * Pass error through core methods * Fix use of Runtime::current in signals package * Fix tests * Add #[track_caller] for better error output and fix maybe_with_rt * provide a help message along with RuntimeError --------- Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
This commit is contained in:
1 parent
9167cd9dec
commit
d07e81005f
12 files changed
+165
-63
No files matched your search
@@ -16,7 +16,7 @@ impl VirtualDom {
|
||||
props: BoxedAnyProps,
|
||||
name: &'static str,
|
||||
) -> &mut ScopeState {
|
||||
let parent_id = self.runtime.current_scope_id();
|
||||
let parent_id = self.runtime.current_scope_id().ok();
|
||||
let height = match parent_id.and_then(|id| self.runtime.get_state(id)) {
|
||||
Some(parent) => parent.height() + 1,
|
||||
None => 0,
|
||||
@@ -47,11 +47,11 @@ impl VirtualDom {
|
||||
|
||||
/// Run a scope and return the rendered nodes. This will not modify the DOM or update the last rendered node of the scope.
|
||||
#[tracing::instrument(skip(self), level = "trace", name = "VirtualDom::run_scope")]
|
||||
#[track_caller]
|
||||
pub(crate) fn run_scope(&mut self, scope_id: ScopeId) -> RenderReturn {
|
||||
debug_assert!(
|
||||
crate::Runtime::current().is_some(),
|
||||
"Must be in a dioxus runtime"
|
||||
);
|
||||
// Ensure we are currently inside a `Runtime`.
|
||||
crate::Runtime::current().unwrap();
|
||||
|
||||
self.runtime.clone().with_scope_on_stack(scope_id, || {
|
||||
let scope = &self.scopes[scope_id.0];
|
||||
let output = {
|
||||
|
||||
Reference in new issue
Block a user