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

Method Report

errorreport/sentry/sentry.go:45–65  ·  view source on GitHub ↗
(err errctx.Error, req *http.Request, meta map[string]any)

Source from the content-addressed store, hash-verified

43}
44
45func (r *reporter) Report(err errctx.Error, req *http.Request, meta map[string]any) {
46 hub := r.hub.Clone()
47 hub.Scope().SetRequest(req)
48 hub.Scope().SetLevel(sentry.LevelError)
49
50 if meta != nil {
51 hub.Scope().SetContext("Processing context", meta)
52 }
53
54 // imgproxy may wrap errors using errctx.WrappedError to add context, so Sentry
55 // would report the error type as *errctx.WrappedError.
56 //
57 // To avoid this, we create the event manually from the original error
58 // and set the correct error type.
59 if event := hub.Client().EventFromException(err, sentry.LevelError); event != nil {
60 // Sentry reports errors in the reverse order: the last one is the outermost error.
61 // So we need to set the type on the last exception.
62 event.Exception[len(event.Exception)-1].Type = errctx.ErrorType(err)
63 hub.CaptureEvent(event)
64 }
65}
66
67func (r *reporter) Close() {
68 r.hub.Flush(flushTimeout)

Callers

nothing calls this directly

Implementers 5

Reportererrorreport/errorreport.go
reportererrorreport/sentry/sentry.go
reportererrorreport/honeybadger/honeybadger.go
reportererrorreport/bugsnag/bugsnag.go
reportererrorreport/airbrake/airbrake.go

Calls 3

ErrorTypeFunction · 0.92
ClientMethod · 0.80
CloneMethod · 0.45

Tested by

no test coverage detected