Skip to content

Commit

Permalink
FES-64-handle-unavailable-delivery-time-for-cart-2 (#58)
Browse files Browse the repository at this point in the history
* adjust the status code return
Co-authored-by: NHT <[email protected]>
  • Loading branch information
nfesta2023 authored Feb 18, 2024
1 parent 65c77ad commit f0373c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/feature/cart/cart.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,12 @@ export class CartController {
}
} catch (error) {
if (error instanceof HttpException) {
res.statusCode = error.getStatus();
if (error.getStatus() == 404) {
res.statusCode = 400;
} else {
res.statusCode = error.getStatus();
}

res.message = error.getResponse();
res.data = null;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/feature/cart/cart.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ export class CartService {

//Check if menu_item_ids do exist
if (menuItems.length != menu_item_ids.length) {
throw new HttpException('Some of menu items do not exist', 404);
throw new HttpException('Some of menu items do not exist', 400);
}

//Check if menu_item_ids belong to the same restaurant
Expand Down

0 comments on commit f0373c2

Please sign in to comment.