feat: notifications retry mechanism and improved error formatting

This commit is contained in:
yusing
2025-05-03 14:30:40 +08:00
parent 2fe4fef779
commit 82c829de18
9 changed files with 146 additions and 54 deletions

View File

@@ -56,9 +56,11 @@ func (e *EventQueue) Start(eventCh <-chan Event, errCh <-chan gperr.Error) {
e.onFlush = func(events []Event) {
defer func() {
if err := recover(); err != nil {
e.onError(gperr.New("recovered panic in onFlush").
Withf("%v", err).
Subject(e.task.Name()))
if err, ok := err.(error); ok {
e.onError(gperr.Wrap(err).Subject(e.task.Name()))
} else {
e.onError(gperr.New("recovered panic in onFlush").Withf("%v", err).Subject(e.task.Name()))
}
if common.IsDebug {
panic(string(debug.Stack()))
}