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

See [Issue](evalphobia#74)
  • Loading branch information
Mohamad mehdi Kharatizadeh committed Jan 5, 2019
1 parent af66214 commit 1f9d365
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 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 @@ -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 1f9d365

Please sign in to comment.