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

CaptureError sends stacktrace of Cause()  #214

@femaref

Description

@femaref

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions