diff --git a/sentry.go b/sentry.go index 59661f8..760b8b5 100644 --- a/sentry.go +++ b/sentry.go @@ -3,6 +3,7 @@ package logrus_sentry import ( "encoding/json" "fmt" + "runtime" "sync" "time" @@ -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) }