HandleWithCtx should be called with defer to recover panics in goroutines
(ctx context.Context, handlerName string)
| 208 | |
| 209 | // HandleWithCtx should be called with defer to recover panics in goroutines |
| 210 | func HandleWithCtx(ctx context.Context, handlerName string) { |
| 211 | if r := recover(); r != nil { |
| 212 | log.Ctx(ctx).Error().Str("handler", handlerName).Msgf("Panic: %v", r) |
| 213 | log.Stack(ctx) |
| 214 | |
| 215 | sentry.CaptureEvent(getEvent(ctx, nil, NewPanic(r), 2, handlerName)) |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | func HandleErrorNoStack(ctx context.Context, err error) { |
| 220 | log.Ctx(ctx).Info().Msgf("Received error, will not handle further: %v", err) |
searching dependent graphs…