Used correct HTTP error

This commit is contained in:
Thastertyn 2024-03-13 21:41:45 +01:00
parent b1fb6ee099
commit 69ca94c77b

View File

@ -62,7 +62,7 @@ class CartService:
return {"Success": "Successfully added to cart"}, 200
except Error as e:
return {"Failed": f"Failed to update item count in cart. Reason: {e}"}, 400
return {"Failed": f"Failed to update item count in cart. Reason: {e}"}, 500
@staticmethod
def delete_from_cart(user_id: str, product_id: int) -> Tuple[Union[dict, str], int]:
@ -85,7 +85,7 @@ class CartService:
return {"Success": "Successfully removed item from cart"}, 200
except Error as e:
return {"Failed": f"Failed to remove item from cart. Reason: {e}"}, 400
return {"Failed": f"Failed to remove item from cart. Reason: {e}"}, 500
@staticmethod
@ -119,7 +119,7 @@ class CartService:
return results, 200
except Error as e:
return {"Failed": f"Failed to load cart. Reason: {e}"}, 400
return {"Failed": f"Failed to load cart. Reason: {e}"}, 500
@staticmethod
@ -176,7 +176,7 @@ class CartService:
# clear cart
except Error as e:
return {"Failed": f"Failed to load cart. Reason: {e}"}, 400
return {"Failed": f"Failed to load cart. Reason: {e}"}, 500
return {"Success": "Successfully purchased"}, 200