mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 04:50:36 +00:00
Fix pcall test, improve scheduler panic message
This commit is contained in:
parent
5905b2d6cf
commit
57677278c4
2 changed files with 9 additions and 6 deletions
|
@ -14,10 +14,10 @@ where
|
|||
where
|
||||
F: Future<Output = ()> + 'fut,
|
||||
{
|
||||
let futs = self
|
||||
.futures
|
||||
.try_lock()
|
||||
.expect("Failed to lock futures queue");
|
||||
let futs = self.futures.try_lock().expect(
|
||||
"Failed to lock futures queue - \
|
||||
make sure not to schedule futures during futures resumption",
|
||||
);
|
||||
futs.push(Box::pin(fut))
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,10 @@ local PORT = 9090 -- NOTE: This must be different from
|
|||
local function test(f, ...)
|
||||
local success, message = pcall(f, ...)
|
||||
assert(not success, "Function did not throw an error")
|
||||
assert(type(message) == "userdata", "Pcall did not return a proper error")
|
||||
assert(
|
||||
type(message) == "string" or type(message) == "userdata",
|
||||
"Pcall did not return a proper error"
|
||||
)
|
||||
end
|
||||
|
||||
-- These are not async but should be pcallable
|
||||
|
@ -24,7 +27,7 @@ local handle = net.serve(PORT, function()
|
|||
return ""
|
||||
end)
|
||||
|
||||
task.delay(0, function()
|
||||
task.delay(0.25, function()
|
||||
handle.stop()
|
||||
end)
|
||||
|
||||
|
|
Loading…
Reference in a new issue