getsentry / raven-go

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

Add CaptureErrorWithExtra() #138

Closed abhi11 closed 6 years ago

abhi11 commented 7 years ago

Enables client to set the extras field while firing a Capture() method

mattrobenolt commented 7 years ago

Awesome, thanks! Do you mind adding a test that covers this? It should be relatively trivial.

abhi11 commented 7 years ago

What exactly do you want in the test ? Something like this:

func TestPacketJSONWithExtra(t *testing.T) {
    packet := &Packet{
        Project:     "1",
        EventID:     "2",
        Message:     "test",
        Timestamp:   Timestamp(time.Date(2000, 01, 01, 0, 0, 0, 0, time.UTC)),
        Level:       ERROR,
        Logger:      "com.getsentry.raven-go.logger-test-packet-json",
                Extra: map[string]interface{}{
                         "key":"value" 
                }
    }

       expected := `the expected string`
       // JSONify and check if matches expected string 
}

Will this suffice ?

syndbg commented 7 years ago

Isn't this a duplicate of #134 ?

abhi11 commented 7 years ago

@mattrobenolt hey, this has been open for a long time.

syndbg commented 7 years ago

@abhi11 No progress neither here nor in #134, unfortunately.

knabben commented 6 years ago

Fixed on #190