-
Notifications
You must be signed in to change notification settings - Fork 0
improve lua error handling #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,13 @@ | ||||||||||||||||||||||||||
| ---Wraps `native` functions so they can safely return | ||||||||||||||||||||||||||
| --- errors and defer with longjump after cleanup | ||||||||||||||||||||||||||
| ---@param native fun(...: any): (any, string?) | ||||||||||||||||||||||||||
| ---@return fun(...: any): any | ||||||||||||||||||||||||||
| return function(native) | ||||||||||||||||||||||||||
| return function(...) | ||||||||||||||||||||||||||
| local value, failure = native(...) | ||||||||||||||||||||||||||
| if failure ~= nil then | ||||||||||||||||||||||||||
| error(failure, 2) | ||||||||||||||||||||||||||
|
Comment on lines
+5
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Capture the Lua error function during wrapper setup. A manifest can replace global Proposed fix+local lua_error = error
+
return function(native)
return function(...)
local value, failure = native(...)
if failure ~= nil then
- error(failure, 2)
+ lua_error(failure, 2)
end📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||
| return value | ||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Correct the error text.
Change
"atleast"to"at least".🤖 Prompt for AI Agents