Neither Jan nor I can reproduce the issue at the heart of #784879, but it did expose a
large side-effect of a previous change I introduced: if OAuth is enabled, we don't
raise exceptions on HTTP errors. This happened automatically with rest-client, but not
when we use the OAuth library directly.
This patch causes us to raise errors as appropriate. I rescue the two most common errors
and re-raise them as RestClient exceptions instead because a large body of code checks for
those. The rest are actual problems that should bubble up.
I also removed a section in WarehouseModel that swallowed all exceptions when creating
buckets. create_bucket itself already rescues the more-specific InternalServerError
exception (because creating a bucket that already exists returns a 500), but this was
eating OAuth exceptions.
The net effect of these changes is that, if you are using OAuth (which is the default
setting), we will raise serious errors (including 403 - Forbidden, but also 500 and 404
errors in most places) as exceptions, as we do when using RestClient (which happens when
there is no OAuth signature required).
A nice little bonus is that, when I went to look at tests, they were failing, but this
patch fixed them. Woo-hoo!
-- Matt