Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

CaptureError sends stacktrace of Cause() #214

Open
femaref opened this issue Oct 29, 2018 · 1 comment
Open

CaptureError sends stacktrace of Cause() #214

femaref opened this issue Oct 29, 2018 · 1 comment

Comments

@femaref
Copy link

femaref commented Oct 29, 2018

Right now, if your error is the following:

import "github.com/pkg/errors"
...
    return errors.WithStack(err)
...

it will not use that stacktrace. The reason is in client.go:

raven-go/client.go

Lines 710 to 712 in 3033899

cause := pkgErrors.Cause(err)
packet := NewPacketWithExtra(err.Error(), extra, append(append(interfaces, client.context.interfaces()...), NewException(cause, GetOrNewStacktrace(cause, 1, 3, client.includePaths)))...)

cause gets used for the Stacktrace generation. However, Cause is called on the result of errors.WithStack, which simply removes that layer, so we don't have a trace anymore.

Is there a reason why Cause is used here? Maybe instead of always taking the Cause, check if the current err has a Stacktrace and cause has not, and use the stack of err?

@femaref
Copy link
Author

femaref commented Oct 29, 2018

pr: #215

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant