Skip to content

Commit

Permalink
use runtime.Frame instead of program counters after braking change to…
Browse files Browse the repository at this point in the history
… github.com/pkg/errors (evalphobia#75)
  • Loading branch information
Mohamad mehdi Kharatizadeh authored and evalphobia committed Jan 9, 2019
1 parent af66214 commit af3520b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions sentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package logrus_sentry
import (
"encoding/json"
"fmt"
"runtime"
"sync"
"time"

Expand Down Expand Up @@ -114,7 +113,7 @@ func NewWithClientSentryHook(client *raven.Client, levels []logrus.Level) (*Sent
StacktraceConfiguration: StackTraceConfiguration{
Enable: false,
Level: logrus.ErrorLevel,
Skip: 5,
Skip: 6,
Context: 0,
InAppPrefixes: nil,
SendExceptionType: true,
Expand Down Expand Up @@ -310,11 +309,9 @@ func (hook *SentryHook) convertStackTrace(st errors.StackTrace) *raven.Stacktrac
stConfig := &hook.StacktraceConfiguration
stFrames := []errors.Frame(st)
frames := make([]*raven.StacktraceFrame, 0, len(stFrames))
for i := range stFrames {
pc := uintptr(stFrames[i])
fn := runtime.FuncForPC(pc)
file, line := fn.FileLine(pc)
frame := raven.NewStacktraceFrame(pc, fn.Name(), file, line, stConfig.Context, stConfig.InAppPrefixes)
for _, stFrame := range stFrames {
frame := raven.NewStacktraceFrame(stFrame.PC, stFrame.Func.Name(), stFrame.File, stFrame.Line,
stConfig.Context, stConfig.InAppPrefixes)
if frame != nil {
frames = append(frames, frame)
}
Expand Down

0 comments on commit af3520b

Please sign in to comment.