-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrorEntry.go
More file actions
51 lines (43 loc) · 1.27 KB
/
errorEntry.go
File metadata and controls
51 lines (43 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package raygunclient
import (
"net/http"
"github.com/gsblue/raygunclient/httpdata"
)
//ErrorEntry holds the information about the error and meta data
//needed to be recorded in raygun
type ErrorEntry struct {
Error error
Request *httpdata.HTTPRequest
CustomData interface{}
User string
Tags []string
}
//NewErrorEntry creates a new error entry
func NewErrorEntry(err error) *ErrorEntry {
return &ErrorEntry{
Error: err,
}
}
// SetRequest is a chainable option-setting method to add a request to this entry.
func (e *ErrorEntry) SetRequest(r *http.Request) *ErrorEntry {
e.Request = httpdata.NewHTTPRequest(r)
return e
}
// SetCustomData is a chainable option-setting method to add arbitrary custom data
// to the entry. Note that the given type (or at least parts of it)
// must implement the Marshaler-interface for this to work.
func (e *ErrorEntry) SetCustomData(data interface{}) *ErrorEntry {
e.CustomData = data
return e
}
// SetUser is a chainable option-setting method to add an affected Username to this
// entry.
func (e *ErrorEntry) SetUser(u string) *ErrorEntry {
e.User = u
return e
}
// SetTags is a chainable option-setting method to add tags to this entry.
func (e *ErrorEntry) SetTags(tags []string) *ErrorEntry {
e.Tags = tags
return e
}