This patch localizes try...except blocks, DRYs construction of
certain HTTP exceptions, and modifies what types of exceptions
are thrown (in some cases), to be more precise.
I also factored out some input validation code that happened
to be mixed up with all the exception handling.
Implements: blueprint grizzly-debt
Change-Id: I1030308bed1ec55477b176bf022118d53b46b7ff