mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Make root() destroy scope if error occurs
This commit is contained in:
parent
c4e1396684
commit
93a2a2c631
2 changed files with 2 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Error stack traces being lost.
|
- Error stack traces being lost.
|
||||||
|
- `root()` now destroys the scope automatically if an error occurs during call.
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ local function root<T...>(fn: (destroy: () -> ()) -> T...): (() -> (), T...)
|
||||||
pop_scope()
|
pop_scope()
|
||||||
|
|
||||||
if not result[1] then
|
if not result[1] then
|
||||||
refs[node] = nil
|
destroy()
|
||||||
throw(`error while running root():\n\n{result[2]}`)
|
throw(`error while running root():\n\n{result[2]}`)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue