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:
Matt HunzingerandEvan Almloff authored and GitHub committed 2024-07-24 13:31:56 -05:00
1 parent 9167cd9dec
commit d07e81005f
12 files changed
+165 -63

No files matched your search

+9 -3
View File
@@ -81,7 +81,8 @@ impl Task {
_ = rt
.sender
.unbounded_send(SchedulerMsg::TaskNotified(self.id))
});
})
.unwrap();
}
/// Poll the task immediately.
@@ -100,7 +101,8 @@ impl Task {
.unbounded_send(SchedulerMsg::TaskNotified(self.id));
}
}
});
})
.unwrap();
}
}
@@ -246,7 +248,11 @@ impl Runtime {
}
pub(crate) fn handle_task_wakeup(&self, id: Task) -> Poll<()> {
debug_assert!(Runtime::current().is_some(), "Must be in a dioxus runtime");
#[cfg(feature = "debug_assertions")]
{
// Ensure we are currently inside a `Runtime`.
Runtime::current().unwrap();
}
let task = self.tasks.borrow().get(id.id).cloned();