feat: add documentation for `gears.protected_call`

This commit is contained in:
devclyde 2022-06-23 15:11:31 -03:00
parent 9109775a74
commit f0f74e786f
No known key found for this signature in database
GPG Key ID: 02F8BEF064CD42DC
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
--- ### Description
--- Call a function in protected mode and handle error reports.
--- ### Information
--- - **Copyright**: 2016 Uli Schlachter
--- - **Originally authored by**: Uli Schlachter
---
--- [See all contributors on GitHub](https://github.com/awesomeWM/awesome/graphs/contributors)
---
--- [View documents](https://awesomewm.org/apidoc/utility_libraries/gears.protected_call.html)
--- @module "gears.protected_call"
local GSafety = {}
--- ### Description
--- Call a function in protected mode and handle error-reporting.
--- If the function call succeeds, all results of the function are returned.
--- Otherwise, an error message is printed and nothing is returned.
--- ### Parameters
--- @param func function The function to call.
--- @param ... any Arguments to the function.
--- ### Returns
--- @return any result The result of the given function, or nothing if an error occurred.
---
--- [View documents](https://awesomewm.org/apidoc/utility_libraries/gears.protected_call.html#gears.protected_call)
GSafety.protected_call = function(func, ...) end
return GSafety