Whats the best way to handle invalid parameters passed in with a GET or POST request in Flask+Python?
Let's say for the sake of argument I handle a GET request using Flask+Python that requires a parameter that needs to be an integer but the client supplies it as a value that cannot be interpreted as an integer.  So, obviously, an exception will be thrown when I try to convert that parameter to an integer.
My question is should I let that exception propagate, thus letting Flask do it's default thing of returning an HTTP status code of 500 back to the client?  Or should I handle it and return a proper (IMO) status code of 400 back to the client?
The first option is the easier of the two.  The downside is that the resulting error isn't clear as to whose at fault here.  A system admin might look at the logs and not knowing anything about Python or Flask might conclude that there's a bug in the code.  However, if I return a 400 then it becomes more clear that the problem might be on the client's end.
What do most people do in these situations?
A status code of 400 means you tell the client "hey, you've messed up, don't try that again". A status code of 500 means you tell the client "hey, I've messed up, feel free to try again later when I've fixed that bug".
In your case, you should return a 400 since the party that is at fault is the client.
Best way to handle invalid GET/POST request parameters with Flask+Python?