From a77eb8c08e2031b8c2435aaf3152545918c08142 Mon Sep 17 00:00:00 2001 From: Ioannis Sermetziadis Date: Mon, 27 Mar 2023 19:48:01 +0300 Subject: [PATCH] fix: make subscription not exists error non-dynamic (#83) --- subscription.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subscription.go b/subscription.go index 4c07052..1eb12bb 100644 --- a/subscription.go +++ b/subscription.go @@ -76,6 +76,8 @@ const ( var ( // ErrSubscriptionStopped a special error which forces the subscription stop ErrSubscriptionStopped = errors.New("subscription stopped") + // ErrSubscriptionNotExists an error denoting that subscription does not exist + ErrSubscriptionNotExists = errors.New("subscription does not exist") errRetry = errors.New("retry subscription client") ) @@ -663,7 +665,7 @@ func (sc *SubscriptionClient) Unsubscribe(id string) error { sub := ctx.GetSubscription(id) if sub == nil { - return fmt.Errorf("subscription id %s doesn't not exist", id) + return fmt.Errorf("%s, %w", id, ErrSubscriptionNotExists) } if sub.status == SubscriptionUnsubcribed {