getsentry / raven-go

Sentry client in Go
https://sentry.io
BSD 3-Clause "New" or "Revised" License
561 stars 148 forks source link

Raven panics when using juju errors #255

Open j-fuentes opened 5 years ago

j-fuentes commented 5 years ago

I am using juju errors in my project and raven-go does not like them.

This example uses standard Go errors:

package main

import (
    "errors"
    "fmt"
    "os"

    "github.com/getsentry/raven-go"
    // "github.com/juju/errors"
)

func main() {
    client, err := raven.New(os.Getenv("SENTRY_DSN"))
    if err != nil {
        panic(err)
    }

    e := errors.New("test")
    s := client.CaptureError(e, nil)
    fmt.Println(s)
}

And it works:

$ go run .
39f60ebda4a946ebb7a2d5d2278f1d2e

However, if I try to use juju errors:

package main

import (
    // "errors"
    "fmt"
    "os"

    "github.com/getsentry/raven-go"
    "github.com/juju/errors"
)

func main() {
    client, err := raven.New(os.Getenv("SENTRY_DSN"))
    if err != nil {
        panic(err)
    }

    e := errors.New("test")
    s := client.CaptureError(e, nil)
    fmt.Println(s)
}

CaptureError panics:

$  go run .
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x727936]

goroutine 1 [running]:
github.com/getsentry/raven-go.NewException(0x0, 0x0, 0xc0001b3e20, 0x3)
        /home/jfuentes/go/src/github.com/getsentry/raven-go/exception.go:12 +0x26
github.com/getsentry/raven-go.(*Client).CaptureError(0xc0000de000, 0x8a8320, 0xc0001ca870, 0x0, 0x0, 0x0, 0x0, 0xc000022118, 0x0)
        /home/jfuentes/go/src/github.com/getsentry/raven-go/client.go:753 +0x2ed
main.main()
        /home/jfuentes/wk/tmp/raven/main.go:19 +0xec
exit status 2
mattrobenolt commented 5 years ago

Which version of raven-go? The line numbers in your stack trace don’t line up to master, so kinda hard to see what’s going on here.

j-fuentes commented 5 years ago

oh sorry, I forgot to mention that. I have updated to the current master and patched the initial comment with the output.