client: include event handling error in returns

This commit is contained in:
Tulir Asokan
2025-07-31 13:46:24 +03:00
parent e1c0e6dd9a
commit a31787f894
4 changed files with 67 additions and 92 deletions
+11 -4
View File
@@ -59,6 +59,16 @@ var (
ErrFailToQueueEvent = errors.New("failed to queue event")
)
func resultToError(res bridgev2.EventHandlingResult) error {
if !res.Success {
if res.Error != nil {
return fmt.Errorf("%w: %w", ErrFailToQueueEvent, res.Error)
}
return ErrFailToQueueEvent
}
return nil
}
type TelegramClient struct {
main *TelegramConnector
ScopedStore *store.ScopedStore
@@ -252,10 +262,7 @@ func NewTelegramClient(ctx context.Context, tc *TelegramConnector, login *bridge
CheckNeedsBackfillFunc: func(ctx context.Context, latestMessage *database.Message) (bool, error) { return true, nil },
})
if !res.Success {
return ErrFailToQueueEvent
}
return nil
return resultToError(res)
},
Handler: dispatcher,
Logger: zaplog.Named("gaps"),