mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-01 00:00:10 +02:00
runtime: update panic messages to include version (#3461)
This commit is contained in:
@@ -260,7 +260,7 @@ cfg_rt! {
|
||||
/// flag is not enabled.
|
||||
pub(super) fn current() -> Self {
|
||||
crate::runtime::context::io_handle()
|
||||
.expect("there is no reactor running, must be called from the context of Tokio runtime")
|
||||
.expect("there is no reactor running, must be called from the context of a Tokio 0.3.x runtime")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -274,7 +274,7 @@ cfg_not_rt! {
|
||||
/// This function panics if there is no current reactor set, or if the `rt`
|
||||
/// feature flag is not enabled.
|
||||
pub(super) fn current() -> Self {
|
||||
panic!("there is no reactor running, must be called from the context of Tokio runtime with `rt` enabled.")
|
||||
panic!("there is no reactor running, must be called from the context of a Tokio 0.3.x runtime with `rt` enabled.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ where
|
||||
F: FnOnce() -> R + Send + 'static,
|
||||
R: Send + 'static,
|
||||
{
|
||||
let rt = context::current().expect("not currently running on the Tokio runtime.");
|
||||
let rt = context::current().expect("not currently running on a Tokio 0.3.x runtime.");
|
||||
rt.spawn_blocking(func)
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ where
|
||||
F: FnOnce() -> R + Send + 'static,
|
||||
R: Send + 'static,
|
||||
{
|
||||
let rt = context::current().expect("not currently running on the Tokio runtime.");
|
||||
let rt = context::current().expect("not currently running on a Tokio 0.3.x runtime.");
|
||||
|
||||
let (task, _handle) = task::joinable(BlockingTask::new(func));
|
||||
rt.blocking_spawner.spawn(task, &rt)
|
||||
|
||||
@@ -97,7 +97,7 @@ impl Handle {
|
||||
/// # }
|
||||
/// ```
|
||||
pub fn current() -> Self {
|
||||
context::current().expect("not currently running on the Tokio runtime.")
|
||||
context::current().expect("not currently running on a Tokio 0.3.x runtime.")
|
||||
}
|
||||
|
||||
/// Returns a Handle view over the currently running Runtime
|
||||
|
||||
@@ -129,7 +129,7 @@ cfg_rt! {
|
||||
T::Output: Send + 'static,
|
||||
{
|
||||
let spawn_handle = runtime::context::spawn_handle()
|
||||
.expect("must be called from the context of Tokio runtime configured with either `basic_scheduler` or `threaded_scheduler`");
|
||||
.expect("must be called from the context of a Tokio 0.3.x runtime configured with either `basic_scheduler` or `threaded_scheduler`");
|
||||
let task = crate::util::trace::task(task, "task");
|
||||
spawn_handle.spawn(task)
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ cfg_rt! {
|
||||
/// panicking.
|
||||
pub(crate) fn current() -> Self {
|
||||
crate::runtime::context::time_handle()
|
||||
.expect("there is no timer running, must be called from the context of Tokio runtime")
|
||||
.expect("there is no timer running, must be called from the context of a Tokio 0.3.x runtime")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ cfg_not_rt! {
|
||||
/// lazy, and so outside executed inside the runtime successfuly without
|
||||
/// panicking.
|
||||
pub(crate) fn current() -> Self {
|
||||
panic!("there is no timer running, must be called from the context of Tokio runtime or \
|
||||
panic!("there is no timer running, must be called from the context of a Tokio 0.3.x runtime or \
|
||||
`rt` is not enabled")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user