MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / New

Function New

errorreport/sentry/sentry.go:22–43  ·  view source on GitHub ↗

New creates and configures a new Sentry reporter

(config *Config)

Source from the content-addressed store, hash-verified

20
21// New creates and configures a new Sentry reporter
22func New(config *Config) (*reporter, error) {
23 if err := config.Validate(); err != nil {
24 return nil, err
25 }
26
27 if len(config.DSN) == 0 {
28 return nil, nil
29 }
30
31 client, err := sentry.NewClient(sentry.ClientOptions{
32 Dsn: config.DSN,
33 Release: config.Release,
34 Environment: config.Environment,
35 })
36 if err != nil {
37 return nil, err
38 }
39
40 hub := sentry.NewHub(client, sentry.NewScope())
41
42 return &reporter{hub: hub}, nil
43}
44
45func (r *reporter) Report(err errctx.Error, req *http.Request, meta map[string]any) {
46 hub := r.hub.Clone()

Callers 1

NewFunction · 0.92

Calls 1

ValidateMethod · 0.45

Tested by

no test coverage detected