diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-01-18 20:46:04 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-01-18 20:46:10 -0800 |
| commit | 5a99a24176d9dd2cea3d802989b47d55bd89e932 (patch) | |
| tree | 3f1e49d960fb4cd5d803276f860566ffe95a3604 /lib/core | |
| parent | 13cab23e204ede4f54e81f500418ece276970f31 (diff) | |
Better error handling.
Diffstat (limited to 'lib/core')
| -rw-r--r-- | lib/core/errors.nom | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/core/errors.nom b/lib/core/errors.nom index 8027228..a84b580 100644 --- a/lib/core/errors.nom +++ b/lib/core/errors.nom @@ -25,7 +25,7 @@ use "core/control_flow" local _a, _b = \($a as lua expr), \($b as lua expr) if _a ~= _b then at_1_fail(\(quote "\($a.source)"), - "Assumption failed: This value was "..tostring(_a).." when it was supposed to be "..tostring(_b)..".") + "Assumption failed: This value was "..tostring(_a).." but it was expected to be "..tostring(_b)..".") end end ") @@ -35,7 +35,7 @@ use "core/control_flow" local _a, _b = \($a as lua expr), \($b as lua expr) if _a == _b then at_1_fail(\(quote "\($a.source)"), - "Assumption failed: This value was "..tostring(_a).." when it wasn't supposed to be.") + "Assumption failed: This value was "..tostring(_a).." but it wasn't expected to be.") end end ") @@ -76,10 +76,10 @@ test: Lua (" do local _fell_through = false - local _result = {pcall(function() + local _result = {xpcall(function() \($action as lua) _fell_through = true - end)} + end, enhance_error)} if _result[1] then \$success_lua else @@ -123,10 +123,10 @@ test: (do $action then always $final_action) compiles to (" do -- do/then always local _fell_through = false - local _results = {pcall(function() + local _results = {xpcall(function() \($action as lua) _fell_through = true - end)} + end, enhance_error)} \($final_action as lua) if not _results[1] then error(_results[2], 0) end if not _fell_through then return table.unpack(_results, 2) end |
