How to get last message on genserver exception in Sentry

Hi all,

I am developing a backend service benefitting genserver goodies. And I have an issue with Sentry contexts. I can get exception notifications, using Logger.add_backend(Sentry.LoggerBackend) on my application start. But I want to add extra information, especially that last message that causes the exception to the sentry context. My handling function is like the following:

def handle_info(payload, state) do
    Sentry.Context.set_extra_context(%{payload: payload})
    raise "BUM!"
    ...
end

I expect to see the payload on the sentry event but I just can see the stacktrace.
My Sentry version is 21.11.0 and I use 8.0.6 version of the Elixir Sentry module
Do you have any idea to get the last message in the Sentry events?

Thanks

2 Likes