Skip to content

Commit 9f8f2d0

Browse files
krzysztofdrysevalphobia
authored andcommitted
Add flag SendExceptionType to configuration. (#49)
1 parent 2362c79 commit 9f8f2d0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

sentry.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ type StackTraceConfiguration struct {
7676
// if the stack frame's package matches one of these prefixes
7777
// sentry will identify the stack frame as "in_app"
7878
InAppPrefixes []string
79+
// whether sending exception type should be enabled.
80+
SendExceptionType bool
7981
}
8082

8183
// NewSentryHook creates a hook to be added to an instance of logger
@@ -106,11 +108,12 @@ func NewWithClientSentryHook(client *raven.Client, levels []logrus.Level) (*Sent
106108
return &SentryHook{
107109
Timeout: 100 * time.Millisecond,
108110
StacktraceConfiguration: StackTraceConfiguration{
109-
Enable: false,
110-
Level: logrus.ErrorLevel,
111-
Skip: 5,
112-
Context: 0,
113-
InAppPrefixes: nil,
111+
Enable: false,
112+
Level: logrus.ErrorLevel,
113+
Skip: 5,
114+
Context: 0,
115+
InAppPrefixes: nil,
116+
SendExceptionType: true,
114117
},
115118
client: client,
116119
levels: levels,
@@ -196,6 +199,9 @@ func (hook *SentryHook) Fire(entry *logrus.Entry) error {
196199
}
197200
err := errors.Cause(err)
198201
exc := raven.NewException(err, currentStacktrace)
202+
if !stConfig.SendExceptionType {
203+
exc.Type = ""
204+
}
199205
packet.Interfaces = append(packet.Interfaces, exc)
200206
packet.Culprit = err.Error()
201207
} else {

0 commit comments

Comments
 (0)