Skip to content

Commit

Permalink
Revert to PC after breaking change in pkg/errors was reverted (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamad mehdi Kharatizadeh authored and evalphobia committed Jan 9, 2019
1 parent af3520b commit b7e4b43
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sentry.go
Expand Up @@ -3,6 +3,7 @@ package logrus_sentry
import (
"encoding/json"
"fmt"
"runtime"
"sync"
"time"

Expand Down Expand Up @@ -309,9 +310,11 @@ func (hook *SentryHook) convertStackTrace(st errors.StackTrace) *raven.Stacktrac
stConfig := &hook.StacktraceConfiguration
stFrames := []errors.Frame(st)
frames := make([]*raven.StacktraceFrame, 0, len(stFrames))
for _, stFrame := range stFrames {
frame := raven.NewStacktraceFrame(stFrame.PC, stFrame.Func.Name(), stFrame.File, stFrame.Line,
stConfig.Context, stConfig.InAppPrefixes)
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)
if frame != nil {
frames = append(frames, frame)
}
Expand Down

0 comments on commit b7e4b43

Please sign in to comment.