Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set mechanism type to generic #897

Merged
merged 2 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog

- Always set Mechanism Type to generic ([#896](https://github.com/getsentry/sentry-go/pull/896))

## 0.29.1

The Sentry SDK team is happy to announce the immediate availability of Sentry Go SDK v0.29.1.
Expand Down
6 changes: 6 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ func TestCaptureException(t *testing.T) {
Type: "*sentry.customErr",
Value: "wat",
Mechanism: &Mechanism{
Type: "generic",
ExceptionID: 0,
IsExceptionGroup: true,
},
Expand All @@ -174,6 +175,7 @@ func TestCaptureException(t *testing.T) {
Value: "wat",
Stacktrace: &Stacktrace{Frames: []Frame{}},
Mechanism: &Mechanism{
Type: "generic",
ExceptionID: 1,
ParentID: Pointer(0),
IsExceptionGroup: true,
Expand All @@ -200,6 +202,7 @@ func TestCaptureException(t *testing.T) {
Type: "*sentry.customErr",
Value: "wat",
Mechanism: &Mechanism{
Type: "generic",
ExceptionID: 0,
IsExceptionGroup: true,
},
Expand All @@ -209,6 +212,7 @@ func TestCaptureException(t *testing.T) {
Value: "err",
Stacktrace: &Stacktrace{Frames: []Frame{}},
Mechanism: &Mechanism{
Type: "generic",
ExceptionID: 1,
ParentID: Pointer(0),
IsExceptionGroup: true,
Expand All @@ -224,6 +228,7 @@ func TestCaptureException(t *testing.T) {
Type: "*errors.errorString",
Value: "original",
Mechanism: &Mechanism{
Type: "generic",
ExceptionID: 0,
IsExceptionGroup: true,
},
Expand All @@ -233,6 +238,7 @@ func TestCaptureException(t *testing.T) {
Value: "wrapped: original",
Stacktrace: &Stacktrace{Frames: []Frame{}},
Mechanism: &Mechanism{
Type: "generic",
ExceptionID: 1,
ParentID: Pointer(0),
IsExceptionGroup: true,
Expand Down
1 change: 1 addition & 0 deletions interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ func (e *Event) SetException(exception error, maxErrorDepth int) {
e.Exception[i].Mechanism = &Mechanism{
IsExceptionGroup: true,
ExceptionID: i,
Type: "generic",
}
if i == 0 {
continue
Expand Down
6 changes: 6 additions & 0 deletions interfaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ func TestSetException(t *testing.T) {
Value: "base error",
Type: "*errors.errorString",
Mechanism: &Mechanism{
Type: "generic",
ExceptionID: 0,
IsExceptionGroup: true,
},
Expand All @@ -268,6 +269,7 @@ func TestSetException(t *testing.T) {
Value: "level 1: base error",
Type: "*fmt.wrapError",
Mechanism: &Mechanism{
Type: "generic",
ExceptionID: 1,
ParentID: Pointer(0),
IsExceptionGroup: true,
Expand All @@ -278,6 +280,7 @@ func TestSetException(t *testing.T) {
Type: "*fmt.wrapError",
Stacktrace: &Stacktrace{Frames: []Frame{}},
Mechanism: &Mechanism{
Type: "generic",
ExceptionID: 2,
ParentID: Pointer(1),
IsExceptionGroup: true,
Expand Down Expand Up @@ -309,6 +312,7 @@ func TestSetException(t *testing.T) {
Value: "the cause",
Type: "*errors.errorString",
Mechanism: &Mechanism{
Type: "generic",
ExceptionID: 0,
IsExceptionGroup: true,
},
Expand All @@ -317,6 +321,7 @@ func TestSetException(t *testing.T) {
Value: "error with cause",
Type: "*sentry.withCause",
Mechanism: &Mechanism{
Type: "generic",
ExceptionID: 1,
ParentID: Pointer(0),
IsExceptionGroup: true,
Expand All @@ -327,6 +332,7 @@ func TestSetException(t *testing.T) {
Type: "*fmt.wrapError",
Stacktrace: &Stacktrace{Frames: []Frame{}},
Mechanism: &Mechanism{
Type: "generic",
ExceptionID: 2,
ParentID: Pointer(1),
IsExceptionGroup: true,
Expand Down
2 changes: 2 additions & 0 deletions logrus/logrusentry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ func Test_entryToEvent(t *testing.T) {
Mechanism: &sentry.Mechanism{
ExceptionID: 0,
IsExceptionGroup: true,
Type: "generic",
},
},
{
Expand All @@ -197,6 +198,7 @@ func Test_entryToEvent(t *testing.T) {
ExceptionID: 1,
IsExceptionGroup: true,
ParentID: sentry.Pointer(0),
Type: "generic",
},
},
},
Expand Down
Loading