1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-10 18:10:49 +09:00

GO-5344: Suppress expected error

This commit is contained in:
Sergey 2025-04-04 10:24:49 +02:00
parent b33c669bac
commit 4ef6b6c3bc
No known key found for this signature in database
GPG key ID: 3B6BEF79160221C6
2 changed files with 9 additions and 4 deletions

View file

@ -218,9 +218,10 @@ func (s *service) Close(ctx context.Context) error {
s.componentCtxCancel()
err = errors.Join(err,
s.crossSpaceSubService.Unsubscribe(allChatsSubscriptionId),
)
unsubErr := s.crossSpaceSubService.Unsubscribe(allChatsSubscriptionId)
if !errors.Is(err, crossspacesub.ErrSubscriptionNotFound) {
err = errors.Join(err, unsubErr)
}
return err
}

View file

@ -18,6 +18,10 @@ var log = logging.Logger(CName).Desugar()
const CName = "core.subscription.crossspacesub"
var (
ErrSubscriptionNotFound = fmt.Errorf("subscription not found")
)
type Service interface {
app.ComponentRunnable
Subscribe(req subscriptionservice.SubscribeRequest) (resp *subscriptionservice.SubscribeResponse, err error)
@ -110,7 +114,7 @@ func (s *service) Unsubscribe(subId string) error {
sub, ok := s.subscriptions[subId]
if !ok {
return fmt.Errorf("subscription not found")
return ErrSubscriptionNotFound
}
err := sub.close()