Skip to content

Commit

Permalink
fix: duplicate error
Browse files Browse the repository at this point in the history
  • Loading branch information
akurilov committed May 5, 2024
1 parent 77dff43 commit e20d214
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion api/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 0 additions & 5 deletions api/grpc/subscriptions/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion api/grpc/subscriptions/service_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
2 changes: 1 addition & 1 deletion api/grpc/subscriptions/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestService_Create(t *testing.T) {
"locked", false,
),
},
err: ErrBusy,
err: ErrUnavailable,
},
"fail": {
req: subscription.Data{
Expand Down

0 comments on commit e20d214

Please sign in to comment.