Replace 'Thread already finished' error with common `Error::CoroutineInactive`

This commit is contained in:
Alex Orlenko 2021-05-03 13:11:59 +01:00
parent 64346ce56c
commit 585c0a25d8
1 changed files with 1 additions and 2 deletions

View File

@ -10,7 +10,6 @@ use crate::value::{FromLuaMulti, MultiValue, ToLuaMulti};
#[cfg(feature = "async")] #[cfg(feature = "async")]
use { use {
crate::{ crate::{
error::ExternalError,
lua::{ASYNC_POLL_PENDING, WAKER_REGISTRY_KEY}, lua::{ASYNC_POLL_PENDING, WAKER_REGISTRY_KEY},
util::get_gc_userdata, util::get_gc_userdata,
value::Value, value::Value,
@ -277,7 +276,7 @@ where
match self.thread.status() { match self.thread.status() {
ThreadStatus::Resumable => {} ThreadStatus::Resumable => {}
_ => return Poll::Ready(Err("Thread already finished".to_lua_err())), _ => return Poll::Ready(Err(Error::CoroutineInactive)),
}; };
let _wg = WakerGuard::new(lua.state, cx.waker().clone()); let _wg = WakerGuard::new(lua.state, cx.waker().clone());