-
-
Notifications
You must be signed in to change notification settings - Fork 387
Open
Description
It would be pretty useful to have an indicator of whether the function may error (and thus needs to be handled with pcall or the like).
---@fallible
---@param bar string
---@return string bar
local function assert_is_foobar(bar)
if bar ~= "foobar" then
error("bar isn't equal to foobar")
end
return bar
endI'm aware of #1881 but it doesn't fullfill the same purpose as @fallible, the main difference being the fact that @noreturn indicates that the function never returns while this indicates that the function could return an error
The LSP server could also potentially show the user a warning if they don't wrap a @fallible function in a pcall call
Arxareon, MillhioreBT and BPplays
Metadata
Metadata
Assignees
Labels
No labels