lua/lua/gmod_integration/shared/sh_errors.lua
2024-02-27 02:47:54 +01:00

28 lines
841 B
Lua

//
// Methods
//
function gmInte.sendLuaErrorReport(err, realm, stack, name, id, uptime)
if (name != "gmod_integration") then return end
if (SERVER && math.Round(RealTime()) == 0) then return timer.Simple(1, function() gmInte.sendLuaErrorReport(err, realm, stack, name, id, math.Round(RealTime())) end) end
gmInte.http.post("/errors",
{
["error"] = err,
["realm"] = realm,
["stack"] = stack,
["name"] = name,
["id"] = id,
["uptime"] = uptime || math.Round(RealTime()),
["identifier"] = SERVER && gmInte.config.id || LocalPlayer():SteamID64()
}
)
end
//
// Hooks
//
hook.Add("OnLuaError", "gmInte:OnLuaError:SendReport", function(err, realm, stack, name, id)
gmInte.sendLuaErrorReport(err, realm, stack, name, id)
end)