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,4 +1,3 @@
|
|||
local throw = require "./throw"
|
||||
local graph = require "./graph"
|
||||
type Node<T> = graph.Node<T>
|
||||
type SourceNode<T> = graph.SourceNode<T>
|
||||
|
|
@ -32,7 +31,7 @@ local function switch<T, U>(source: () -> T): (map: Map<T, ((() -> U)?)>) -> ()
|
|||
if component == nil then return nil end
|
||||
|
||||
if type(component) ~= "function" then
|
||||
throw "map must map a value to a function"
|
||||
error "map must map a value to a function"
|
||||
end
|
||||
|
||||
local new_scope = create_node(owner, false, false)
|
||||
|
|
@ -40,7 +39,7 @@ local function switch<T, U>(source: () -> T): (map: Map<T, ((() -> U)?)>) -> ()
|
|||
|
||||
push_scope(new_scope)
|
||||
|
||||
local ok, result = pcall(component)
|
||||
local ok, result = xpcall(component, debug.traceback)
|
||||
|
||||
pop_scope()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue