Skip to content

Commit

Permalink
fix: Use NewEvent to init Event struct (#220)
Browse files Browse the repository at this point in the history
Existing code examples write to maps in Event without doing proper nil-check, assuming the maps are non-nil.

This reverts a subtle behavior change introduced in v0.6.0.
  • Loading branch information
gukz authored May 11, 2020
1 parent 550a179 commit 51568d8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ func (client *Client) eventFromException(exception error, level Level) *Event {
err = usageError{fmt.Errorf("%s called with nil error", callerFunctionName())}
}

event := &Event{Level: level}
event := NewEvent()
event.Level = level

for i := 0; i < maxErrorDepth && err != nil; i++ {
event.Exception = append(event.Exception, Exception{
Expand Down

0 comments on commit 51568d8

Please sign in to comment.