From 6c54c98e3304d294e6b5d95e941113c15136c8f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emir=20Ribi=C4=87?= Date: Tue, 29 Oct 2024 13:11:25 +0100 Subject: [PATCH] set mechanism type to generic --- CHANGELOG.md | 2 ++ client_test.go | 6 ++++++ interfaces.go | 1 + interfaces_test.go | 6 ++++++ logrus/logrusentry_test.go | 2 ++ 5 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3229a9dad..180549020 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/client_test.go b/client_test.go index 58dcaaca9..60d63e2ea 100644 --- a/client_test.go +++ b/client_test.go @@ -165,6 +165,7 @@ func TestCaptureException(t *testing.T) { Type: "*sentry.customErr", Value: "wat", Mechanism: &Mechanism{ + Type: "generic", ExceptionID: 0, IsExceptionGroup: true, }, @@ -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, @@ -200,6 +202,7 @@ func TestCaptureException(t *testing.T) { Type: "*sentry.customErr", Value: "wat", Mechanism: &Mechanism{ + Type: "generic", ExceptionID: 0, IsExceptionGroup: true, }, @@ -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, @@ -224,6 +228,7 @@ func TestCaptureException(t *testing.T) { Type: "*errors.errorString", Value: "original", Mechanism: &Mechanism{ + Type: "generic", ExceptionID: 0, IsExceptionGroup: true, }, @@ -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, diff --git a/interfaces.go b/interfaces.go index cacb25436..9f0d9d885 100644 --- a/interfaces.go +++ b/interfaces.go @@ -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 diff --git a/interfaces_test.go b/interfaces_test.go index 718fcfaa0..bf7b96ca1 100644 --- a/interfaces_test.go +++ b/interfaces_test.go @@ -260,6 +260,7 @@ func TestSetException(t *testing.T) { Value: "base error", Type: "*errors.errorString", Mechanism: &Mechanism{ + Type: "generic", ExceptionID: 0, IsExceptionGroup: true, }, @@ -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, @@ -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, @@ -309,6 +312,7 @@ func TestSetException(t *testing.T) { Value: "the cause", Type: "*errors.errorString", Mechanism: &Mechanism{ + Type: "generic", ExceptionID: 0, IsExceptionGroup: true, }, @@ -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, @@ -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, diff --git a/logrus/logrusentry_test.go b/logrus/logrusentry_test.go index db303e43c..de68e16d3 100644 --- a/logrus/logrusentry_test.go +++ b/logrus/logrusentry_test.go @@ -185,6 +185,7 @@ func Test_entryToEvent(t *testing.T) { Mechanism: &sentry.Mechanism{ ExceptionID: 0, IsExceptionGroup: true, + Type: "generic", }, }, { @@ -197,6 +198,7 @@ func Test_entryToEvent(t *testing.T) { ExceptionID: 1, IsExceptionGroup: true, ParentID: sentry.Pointer(0), + Type: "generic", }, }, },