mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Try improve error reporting
This commit is contained in:
parent
3b22f6ccf9
commit
58a31a1b32
16 changed files with 164 additions and 55 deletions
|
|
@ -1,6 +1,5 @@
|
|||
local typeof = game and typeof or require "../test/mock".typeof :: never
|
||||
|
||||
local throw = require "./throw"
|
||||
local graph = require "./graph"
|
||||
local get_scope = graph.get_scope
|
||||
local push_cleanup = graph.push_cleanup
|
||||
|
|
@ -14,14 +13,14 @@ local function helper(obj: any)
|
|||
elseif obj.disconnect then function() obj:disconnect() end
|
||||
elseif obj.Destroy then function() obj:Destroy() end
|
||||
elseif obj.Disconnect then function() obj:Disconnect() end
|
||||
else throw("cannot cleanup given object")
|
||||
else error "cannot cleanup given object"
|
||||
end
|
||||
|
||||
local function cleanup(value: unknown)
|
||||
local scope = get_scope()
|
||||
|
||||
if not scope then
|
||||
throw "cannot cleanup outside a stable or reactive scope"
|
||||
error "cannot cleanup outside a stable or reactive scope"
|
||||
end; assert(scope)
|
||||
|
||||
if type(value) == "function" then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue