Skip to content

Commit

Permalink
Set mechanism type to generic (#897)
Browse files Browse the repository at this point in the history
* set mechanism type to generic

* Update CHANGELOG.md
  • Loading branch information
ribice authored Oct 29, 2024
1 parent 6bd150f commit ec151c7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
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/897))

## 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

0 comments on commit ec151c7

Please sign in to comment.