mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Improve error trace reporting
This commit is contained in:
parent
ccb36df365
commit
be15f69522
2 changed files with 19 additions and 2 deletions
|
|
@ -1,8 +1,25 @@
|
|||
local function get_path(s)
|
||||
if string.sub(s, #s - 4, #s) == ".luau" then
|
||||
s = string.sub(s, 1, #s - 5)
|
||||
print("test, ", s)
|
||||
end
|
||||
|
||||
return string.split(s, string.match(s, "%w+/") and "/" or ".")
|
||||
end
|
||||
|
||||
local root do
|
||||
local path = get_path(debug.info(1, "s"))
|
||||
root = path[#path - 1]
|
||||
end
|
||||
|
||||
local function throw(msg: string)
|
||||
local stack = 1
|
||||
|
||||
while debug.info(stack, "s") == debug.info(1, "s") do
|
||||
local path = get_path(debug.info(stack, "s"))
|
||||
|
||||
while path[#path] == root or path[#path - 1] == root do
|
||||
stack += 1
|
||||
path = get_path(debug.info(stack, "s"))
|
||||
end
|
||||
|
||||
error(msg, stack)
|
||||
|
|
|
|||
2
todo.md
2
todo.md
|
|
@ -5,7 +5,7 @@
|
|||
- better error reporting and stack traces in strict mode
|
||||
- auto-enable of strict mode depending on compiler optimizaton level
|
||||
- check smoothness of spring at high frequency updates
|
||||
- review alternative to nested properties, merge function
|
||||
- aggregate initialization of properties
|
||||
- implement from solid
|
||||
- [x] onCleanup > `cleanup()`
|
||||
- [x] Index > `indexes()`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue