(err error, tags ...map[string]string)
| 166 | } |
| 167 | |
| 168 | func Error(err error, tags ...map[string]string) { |
| 169 | if err == nil || _config == nil || errors.IsNoTelemetry(err) { |
| 170 | return |
| 171 | } |
| 172 | |
| 173 | if shouldBlock(err, _config.BackoffMode) { |
| 174 | return |
| 175 | } |
| 176 | |
| 177 | mergedTags := maps.MergeStrMapsString(tags...) |
| 178 | |
| 179 | sentry.WithScope(func(scope *sentry.Scope) { |
| 180 | e := EventFromException(err) |
| 181 | scope.SetUser(sentry.User{ID: _config.UserID}) |
| 182 | scope.SetTags(maps.MergeStrMapsString(_config.Properties, mergedTags)) |
| 183 | scope.SetTags(map[string]string{"error_type": e.Exception[0].Type}) |
| 184 | sentry.CaptureEvent(e) |
| 185 | |
| 186 | go sentry.Flush(10 * time.Second) |
| 187 | }) |
| 188 | } |
| 189 | |
| 190 | func EventFromException(exception error) *sentry.Event { |
| 191 | stacktrace := sentry.ExtractStacktrace(exception) |
no test coverage detected