Report reports an error to all configured reporters with the request and its metadata.
(err errctx.Error, req *http.Request)
| 82 | |
| 83 | // Report reports an error to all configured reporters with the request and its metadata. |
| 84 | func (r *Reporter) Report(err errctx.Error, req *http.Request) { |
| 85 | meta, ok := req.Context().Value(metaCtxKey{}).(map[string]any) |
| 86 | if !ok { |
| 87 | meta = nil |
| 88 | } |
| 89 | |
| 90 | if url := err.DocsURL(); url != "" { |
| 91 | meta = maps.Clone(meta) |
| 92 | meta["Documentation URL"] = url |
| 93 | } |
| 94 | |
| 95 | for _, reporter := range r.reporters { |
| 96 | reporter.Report(err, req, meta) |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | // Close closes all reporters |
| 101 | func (r *Reporter) Close() { |