adds error handling for invalid carts