Closed zerkms closed 6 years ago
I see now - it's possible to pass User
as an interface.
Sorry for not mentioning how I solved it.
My final solution, with irrelevant pieces removed looks like this
interfaces := make([]sentry.Interface, 0, 3)
u := &sentry.User{
ID: user.ID,
Username: user.Username,
Email: user.Email,
IP: user.IP,
}
interfaces = append(interfaces, u)
packet := sentry.NewPacket(err.Error(), interfaces...)
Thank you @zerkms. I had the same question, and this helps me resolve it!
At this moment there is no way to safely capture the user context
The suggested example from https://blog.sentry.io/2015/07/07/logging-go-errors would cause a condition race if run in a concurrent environment.
There should be a way to do that safely without creating a new client for every request (unless it's by design)