• [PRERELEASE] Sentry.lua - Catch Lua errors like a pro
    12 replies, posted
https://files.facepunch.com/forum/upload/110874/6500474a-e225-4db8-9b50-a5b1d09c1769/sentry logo.png Sentry.lua - You deserve to know how bad your code is Sentry is a fantastic service that lets you know whenever you deploy broken code. Garry loves it, loads of random people on the Sentry customers page love it, I love it. The main problem is there's no client for GLua. UNTIL NOW! Tightly Integrated Garry's Mod Error tracking! https://files.facepunch.com/forum/upload/110874/faabdd9e-0b68-4045-9d81-6ec8b6654992/image.png It tracks which player caused this error! It tracks (roughly) what they were doing when the error happened! It points the finger of blame at the terrible workshop addons you're using that spam errors! It does a bunch of things that the SDK docs say you have to do! It mostly works! How to use this Download and install the correct version of luaerror from your server (eg gmsv_luaerror_linux.dll) Set up a project in Sentry Find your DSN Upload sentry.lua to lua/includes/modules on the server Create lua/autorun/server/sentry.lua on the server with the contents require( "sentry" ) sentry.Setup( "YOUR DSN HERE", { server_name = "SHORT NAME FOR SERVER" } ) Enjoy being flooded with emails about Lua errors More Info There's more info in the README on Github, and LDoc generated API docs available Why is this in prerelease? I was developing this for a server, but they ran out of players while I was still tinkering. I'm pretty sure this works, but without an active server to test on I can't exactly be sure - so I'm going to hold off on uploading it to the workshop for now. Please help me test this. I'll more than gladly help if it breaks your server. Known Caveats Doesn't create transactions in entity hooks (eg ENT:Think etc) Doesn't carry transaction contexts across callbacks (eg timers) [I'm working on this] Wraps every hook.Call with a xpcall. I'm pretty sure this is OK with the JIT and everything but it might not be. TBD.
I keep getting this [ERROR] error in error handling 1. unknown - [C]:-1 2. error - [C]:-1 3. ExecuteTransaction - lua/includes/modules/sentry.lua:874 4. unknown - lua/includes/modules/sentry.lua:1078
That's weird. What happens if you run lua_run sentry.CaptureException('whoops')
So I am not 100% on how this works as I would love to implement it instead of relying on shotty survey reports. Does this just capture any lua exception that happens in the game or does it require a specific function to be ran around your code to catch it?
I'm going to assume gmsv_luaerror catches all Lua errors that the sever knows about.
lua_run sentry.CaptureException('whoops') sentry.CaptureException('whoops')... [ERROR] lua/includes/modules/sentry.lua:432: attempt to call field 'FindWorkshopAddonFileOwner' (a nil value) 1. FindWorkshopAddonFileOwner - [C]:-1 2. calculateBlame - lua/includes/modules/sentry.lua:432 3. buildPayload - lua/includes/modules/sentry.lua:623 4. CaptureException - lua/includes/modules/sentry.lua:737 5. unknown - lua_run:1
Yeah pretty much. The module changes a couple of functions (net.Incoming, concommand.Run and hook.Call) to capture errors that happen inside them, and gm_luaerror captures everything else. It doesn't capture errors that happen on clients because they don't have enough information on them. Interesting, can you make sure there are no errors at the very beginning of your server's bootup?
i have server, some clientside code is putting errors for some people. how can i disable the error? from showing in their console and the server console? (it is from an addon, except i dont know how to fix the error occuring without breaking the addon... the error is not an issue)
Get somebody to fix it for you. Browse 2327 Jobs · gmodstore
This is the only thing it says before ////////////////Sentry Loaded.//////////////// [ERROR] [ERROR] lua/autorun/server/sentry_load.lua:3: Module not found! 1. require - [C]:-1 2. unknown - lua/autorun/server/sentry_load.lua:3
Honestly I have no idea, that's bizarre. I'm assuming you have the latest gmod, latest gmsv_luaerror_xxx.dll as appropriate for your platform and a normal srcds setup?
sorry for pushing this thread but this may be usefull as your "template" says we should use this style: require( "sentry" ) sentry.Setup( "YOUR DSN HERE", { server_name = "SHORT NAME FOR SERVER" } )
Sorry, you need to Log In to post a reply to this thread.