-
Notifications
You must be signed in to change notification settings - Fork 246
Closed
Labels
Description
How do you use Sentry?
Self-hosted / on-premises
SDK version
0.36.0
Go version
1.25.3
Are you using Go Modules?
yes
Steps to reproduce
Handle mongo go driver's mongo.CommandError and send as exception to the sentry. I am not sure this bug belongs to Mongo driver or Sentry Go SDK.
func main() {
cursor, err := db.Collection("c").Find(ctx, mongo.M{})
if err != nil {
sentry.CurrentHub().CaptureException(err)
return err
}
// reading stuff
if err = cursor.Err(); err != nil {
sentry.CurrentHub().CaptureException(err)
return err
}
}Expected result
No panic
Actual result
Panicking at this line with the following trace (this trace was from our production application):
2025-10-19 19:41:38.181
app/pkg/sentry.(*isentry).CaptureException(0x2aa6b77?, {0x30e87e0?, 0xc001273460?})
2025-10-19 19:41:38.181
/home/runner/go/pkg/mod/github.com/getsentry/sentry-go@v0.36.0/hub.go:255 +0xac
2025-10-19 19:41:38.181
github.com/getsentry/sentry-go.(*Hub).CaptureException(0xc0005bcbd0, {0x30e87e0, 0xc001273460})
2025-10-19 19:41:38.181
/home/runner/go/pkg/mod/github.com/getsentry/sentry-go@v0.36.0/client.go:448 +0x3d
2025-10-19 19:41:38.181
github.com/getsentry/sentry-go.(*Client).CaptureException(0xc0004e5200, {0x30e87e0?, 0xc001273460?}, 0xc003f9e5a0, {0x30ea080, 0xc00052edc0})
2025-10-19 19:41:38.181
/home/runner/go/pkg/mod/github.com/getsentry/sentry-go@v0.36.0/client.go:600 +0x1a5
2025-10-19 19:41:38.181
github.com/getsentry/sentry-go.(*Client).EventFromException(0xc0004e5200, {0x30e87e0, 0xc001273460}, {0x2aa7ab4, 0x5})
2025-10-19 19:41:38.181
/home/runner/go/pkg/mod/github.com/getsentry/sentry-go@v0.36.0/interfaces.go:425
2025-10-19 19:41:38.181
github.com/getsentry/sentry-go.(*Event).SetException(...)
2025-10-19 19:41:38.181
/home/runner/go/pkg/mod/github.com/getsentry/sentry-go@v0.36.0/exception.go:19 +0xf6
2025-10-19 19:41:38.181
github.com/getsentry/sentry-go.convertErrorToExceptions({0x30e87e0, 0xc001273460}, 0x64)
2025-10-19 19:41:38.181
/home/runner/go/pkg/mod/github.com/getsentry/sentry-go@v0.36.0/exception.go:95 +0x571
2025-10-19 19:41:38.181
github.com/getsentry/sentry-go.convertErrorDFS({0x30e87e0, 0xc001273460}, 0xc001927448, 0x0, {0x0, 0x0}, 0xc001927588, 0x64, 0x0)
2025-10-19 19:41:38.181
/home/runner/go/pkg/mod/github.com/getsentry/sentry-go@v0.36.0/exception.go:95 +0x571
2025-10-19 19:41:38.181
github.com/getsentry/sentry-go.convertErrorDFS({0x30e87e0, 0xc001273420}, 0xc001927448, 0xc0010988f0, {0x2aaa028, 0x6}, 0xc001927588, 0x64, 0x1)
2025-10-19 19:41:38.181
/home/runner/go/pkg/mod/github.com/getsentry/sentry-go@v0.36.0/exception.go:45 +0x8a
2025-10-19 19:41:38.181
github.com/getsentry/sentry-go.convertErrorDFS({0x30ed240, 0xc0005e7a40}, 0xc001927448, 0xc0010988f8, {0x2aaa028, 0x6}, 0xc001927588, 0x64, 0x2)
2025-10-19 19:41:38.181
goroutine 792515 [running]:
2025-10-19 19:41:38.181
2025-10-19 19:41:38.181
panic: runtime error: hash of unhashable type mongo.CommandError
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Waiting for: Product Owner