I've got a GAE Flex/Flask/Python app. I do some processing that is usually very quick, but sometimes it exceeds gunicorn's timeout, and my app displays this very ugly response:
502 Bad Gateway
----------
nginx
I would like to catch these gunicorn errors and instead display a much more user friendly error message with Flask.
My Flask code is wrapped in a try/except block like this:
try:
do_processing()
except Exception:
show_error_msg()
but my code never gets to show_error_msg()
.
I was hoping someone had a good solution for this.