raven-go icon indicating copy to clipboard operation
raven-go copied to clipboard

Raven panics when using juju errors

Open j-fuentes opened this issue 6 years ago • 2 comments

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

j-fuentes avatar May 02 '19 11:05 j-fuentes

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.

mattrobenolt avatar May 02 '19 11:05 mattrobenolt

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

  • go version go1.12
  • raven-go commit: 919484f041ea21e7e27be291cee1d6af7bc98864

j-fuentes avatar May 02 '19 12:05 j-fuentes