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>
|
||||
local create_node = graph.create_node
|
||||
|
|
@ -44,10 +43,10 @@ local function context<T>(...: T): Context<T>
|
|||
if has_default ~= nil then
|
||||
return default_value
|
||||
else
|
||||
throw("attempt to get context when no context is set and no default context is set")
|
||||
error("attempt to get context when no context is set and no default context is set", 0)
|
||||
end
|
||||
else -- set
|
||||
if not scope then return throw("attempt to set context outside of a vide scope") end
|
||||
if not scope then return error("attempt to set context outside of a vide scope", 0) end
|
||||
|
||||
local value, component = ...
|
||||
|
||||
|
|
@ -62,7 +61,7 @@ local function context<T>(...: T): Context<T>
|
|||
pop_scope()
|
||||
|
||||
if not ok then
|
||||
throw(`error while running context:\n\n{result}`)
|
||||
error(`error while running context:\n\n{result}`, 0)
|
||||
end
|
||||
|
||||
return result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue