Skip to content

Commit

Permalink
[fix] ошибка 404 при пустой корзине
Browse files Browse the repository at this point in the history
  • Loading branch information
goriiin committed Dec 21, 2024
1 parent 33a2b35 commit c65ce55
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions internal/usecase/orders/create_order_from_cart.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package orders

import (
"context"
"errors"
"github.com/go-park-mail-ru/2024_2_kotyari/internal/errs"
"log/slog"
"strconv"
"time"

order "github.com/go-park-mail-ru/2024_2_kotyari/internal/model"
Expand Down Expand Up @@ -32,7 +31,7 @@ func (m *OrdersManager) CreateOrderFromCart(ctx context.Context, address string,

if len(cartItems) == 0 {
m.logger.Error("[OrdersManager.CreateOrderFromCart] cart is empty for user: ", slog.Uint64("user_id", uint64(userID)))
return nil, errors.New("cart is empty for user: " + strconv.Itoa(int(userID)))
return nil, errs.EmptyCart
}

var totalPrice uint32
Expand Down

0 comments on commit c65ce55

Please sign in to comment.