Bug Description
In pkg/gofr/subscriber.go:69-72, when a subscription handler returns an error, it is logged but then discarded by returning nil. This breaks error propagation and can lead to silent data loss.
Root Cause
The error from the handler is intentionally replaced with nil:
err = func(ctx *Context) error {
defer func() {
panicRecovery(recover(), ctx.Logger)
}()
return handler(ctx)
}(msgCtx)
if err != nil {
s.container.Logger.Errorf("error in handler for topic %s: %v", topic, err)
return nil // BUG: error is swallowed, caller sees success
}
Additionally, on line 77, msg.Commit() is called without checking its return value:
if msg.Committer != nil {
msg.Commit() // error return value ignored
}
Bug Description
In
pkg/gofr/subscriber.go:69-72, when a subscription handler returns an error, it is logged but then discarded by returningnil. This breaks error propagation and can lead to silent data loss.Root Cause
The error from the handler is intentionally replaced with
nil:Additionally, on line 77,
msg.Commit()is called without checking its return value: