I agree with you on the enum conventions, I’ve fixed that.
However, why do you recommend not using Sentry’s free offerings? It’s definitely not as good as hosting it yourself, but for most it’s a quick, easy, and a good enough solution you can pop into your game in < 1 hour and forget about it. Like Crazyman said, if you don’t log errors at all, it’s like they never happen- and this can get you started, at the least.
That being said, I am interested in a tutorial on how to set something like that up.
I don’t recommend using it because of the low quotas. However, if you don’t have that many events and the free tier works for you, go for it. It’s just that hosting it yourself is much better because there’s no limitations.
Found this thread because I ended up getting a Sponsored Sentry plan through the Github Student Developer Pack, which gives me 500k events/mo for free while I’m a student. (I highly suggest signing up for this if you’re in school, and even if you aren’t you can still apply and get some free goodies)
Thanks for this module, I plan to use it soon for an upcoming project!
So I’m using ScriptContext.Error as a catch-all handler for all Errors that can occur in the game and then sending them to Sentry. The only problem I’ve come across is that the trace that is passed by ScriptContext.Error is not the same format as debug.traceback().
So I ended up adding this to the StringTraceToTable() function.
The main addition is matching for the trace format that ScriptContext.Error uses, and then recording them as path2, lineNum2, value2 respectively.
local function StringTraceToTable(trace)
local stacktrace = {}
for line in trace:gmatch("[^\n\r]+") do
if (not line:match("^Stack Begin$") and not line:match("^Stack End$")) then
local path, lineNum, value = line:match("^Script '(.-)', Line (%d+)%s?%-?%s?(.*)$")
local path2, lineNum2, value2 = line:match("^(.-), line (%d+)%s?%-?%s?(.*)$")
print(path2, lineNum2, value2)
if (path and lineNum and value) then
stacktrace[#stacktrace + 1] = {
filename = path;
["function"] = value or "nil";
lineno = lineNum;
}
elseif (path2 and lineNum2 and value2) then
stacktrace[#stacktrace + 1] = {
filename = path2;
["function"] = value2 or "nil";
lineno = lineNum2;
}
else
return false, "invalid traceback"
end
end
end
if (#stacktrace == 0) then
return false, "invalid traceback"
end
local sorted = {}
for i = #stacktrace, 1, -1 do
sorted[i] = stacktrace[i]
end
return true, sorted
end
I figured out how you can log all errors and send it to raven. Here’s how:
Make a new script in serverscriptservice to require the module and set the client like so
local Raven = require(game.ReplicatedStorage.Raven)
local client = Raven:Client("DSN here")
then use scriptcontext to log all errors that happen like so
I’m aware this could be due to the module being old, but my DSN apparently is invalid according to Raven. (returning ‘protocol not valid’)
My DSN is formatted like this (obviously not the real DSN, but should give you an idea) https://lowercase_hexadecimal@sentry.io/some_numbers
EDIT: Nevermind. (Leaving this here for any future users)
The new DSN (which you get on the project page) is not the one the module expects. You need to go in to the project settings, Client Keys (DSN) and get the deprecated DSN.
It’d be helpful if the OP, or someone else, updates this module to work with any changes Sentry may have made.
I don’t have any plans to fix this issue in the near future; as you mentioned Sentry still displays the deprecated DSN, and I’m currently working on an overhaul to this module which will provide more of what Sentry has to offer.
I made a new repo for it here
It is at or above feature parity with the original module but some features are still missing. I’ll be updating it over the coming weeks with more features and docs. Once it’s ready I’ll make a new post for it with an updated tutorial.
The module expects a different DSN which was mentioned further up on the thread. On the page displaying the DSN click on the link as seen in the screenshot below and use that instead.
I don’t quite remember but I think it had something to do with the parameters of the function you are trying to use having been changed. Check what parameters the function accepts in the source.