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
@@ -397,7 +397,7 @@ impl<Args: 'static, Ret: 'static> Callback<Args, Ret> {
|
||||
));
|
||||
Self {
|
||||
callback,
|
||||
origin: current_scope_id().expect("to be in a dioxus runtime"),
|
||||
origin: current_scope_id().unwrap(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ impl<Args: 'static, Ret: 'static> Callback<Args, Ret> {
|
||||
as Rc<RefCell<dyn FnMut(Args) -> Ret>>));
|
||||
Self {
|
||||
callback,
|
||||
origin: current_scope_id().expect("to be in a dioxus runtime"),
|
||||
origin: current_scope_id().unwrap(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ impl<Args: 'static, Ret: 'static> Callback<Args, Ret> {
|
||||
value
|
||||
})
|
||||
})
|
||||
.expect("Callback must be called from within the dioxus runtime")
|
||||
.unwrap()
|
||||
} else {
|
||||
panic!("Callback was manually dropped")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user