diff --git a/api/client_test.go b/api/client_test.go index 3924db9..38b7d79 100644 --- a/api/client_test.go +++ b/api/client_test.go @@ -482,7 +482,7 @@ func TestClient_CreateSubscription(t *testing.T) { "busy": { svcSubs: subscriptions.NewServiceMock(), descr: "busy", - err: subscriptions.ErrBusy, + err: subscriptions.ErrUnavailable, }, } for k, c := range cases { diff --git a/api/grpc/subscriptions/service.go b/api/grpc/subscriptions/service.go index b847e70..50f87ea 100644 --- a/api/grpc/subscriptions/service.go +++ b/api/grpc/subscriptions/service.go @@ -39,9 +39,6 @@ type service struct { // ErrNotFound indicates the subscription is missing in the storage and can not be read/updated/deleted. var ErrNotFound = errors.New("subscription was not found") -// ErrBusy indicates a storage entity is locked and the operation should be retried. -var ErrBusy = errors.New("subscription is busy, retry the operation") - // ErrInternal indicates some unexpected internal failure. var ErrInternal = errors.New("internal failure") @@ -262,8 +259,6 @@ func decodeError(src error) (dst error) { dst = fmt.Errorf("%w: %s", ErrInvalid, src) case s.Code() == codes.ResourceExhausted: dst = fmt.Errorf("%w: %s", limits.ErrReached, src) - case s.Code() == codes.Unavailable: - dst = fmt.Errorf("%w: %s", ErrBusy, src) case s.Code() == codes.Unauthenticated: dst = fmt.Errorf("%w: %s", auth.ErrAuth, src) case s.Code() == codes.Unavailable: diff --git a/api/grpc/subscriptions/service_mock.go b/api/grpc/subscriptions/service_mock.go index f41793d..4aeb1b1 100644 --- a/api/grpc/subscriptions/service_mock.go +++ b/api/grpc/subscriptions/service_mock.go @@ -27,7 +27,7 @@ func (sm serviceMock) Create(ctx context.Context, userId string, subData subscri case "limit_reached": err = limits.ErrReached case "busy": - err = ErrBusy + err = ErrUnavailable default: id = "sub0" } diff --git a/api/grpc/subscriptions/service_test.go b/api/grpc/subscriptions/service_test.go index 99eb047..444ed68 100644 --- a/api/grpc/subscriptions/service_test.go +++ b/api/grpc/subscriptions/service_test.go @@ -37,7 +37,7 @@ func TestService_Create(t *testing.T) { "locked", false, ), }, - err: ErrBusy, + err: ErrUnavailable, }, "fail": { req: subscription.Data{