Skip to content

Instantly share code, notes, and snippets.

@FlorianLeChat
Created August 7, 2021 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FlorianLeChat/8776a5eb28fd8297a83139358ab57746 to your computer and use it in GitHub Desktop.
Save FlorianLeChat/8776a5eb28fd8297a83139358ab57746 to your computer and use it in GitHub Desktop.
Allows to handle errors in a customized way and without going through the default features of Garry's Mod.
local ErrorHandler = _R[1]
_R[1] = function(...)
-- We retrieve some information about the error.
local data = {
path = table.concat({...}),
trace = debug.traceback()
}
-- Then, you can make an HTTP request or trigger a hook for other scripts.
-- http.Post("url", data)
-- hook.Run("OnLuaError", data)
-- Finally, we call the old function in order not to break the function.
return ErrorHandler(...)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment