Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle reservation failure #35

Open
ipwnponies opened this issue May 1, 2019 · 1 comment
Open

Handle reservation failure #35

ipwnponies opened this issue May 1, 2019 · 1 comment

Comments

@ipwnponies
Copy link
Collaborator

When attempting to reserve a meal that's booked out, the response is HTTP 400, with response:

{
  "error": "ERROR_AMOUNT_LIMIT"
}

It would be great handle this case, instead of retrying. Also will empower #9, since we can differentiate between when to retry and when to fallback to second choice.

mealpy/mealpy/mealpy.py

Lines 129 to 130 in 5fc5bc7

request = self.session.post(RESERVATION_URL, json=reserve_data)
return request.status_code

@ipwnponies
Copy link
Collaborator Author

ipwnponies commented May 5, 2019

I'm going to add more responses that could be handled here. We can split the ticket if it gets large or when we get to it.

Kitchen closed

{
  "error": "ERROR_KITCHEN_CLOSED"
}

Another meal is already reserved

{
  "error": "ERROR_RESERVATION_LIMIT"
}

@ipwnponies ipwnponies changed the title Handle reservation failure because meal is out of stock Handle reservation failure May 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant