zerovm/zerocloud — pull request #137 by larsbutler (2014-08-18 12:18:01+00:00)
Title: Debug logging for `zerovm_query`

Partially addresses https://github.com/zerovm/zerocloud/issues/106.

This change add debug logging output for all of the HTTP responses returned by `zerovm_query`. This includes a change to the way the responses are propagated. Instead of `return` statements, HTTP response can be raised as exceptions. This helps in a couple of ways:

1. We can differentiate "normal" or "successful" responses from error conditions.
2. We can do slightly different logging depending on the case. In the successful case, it's not really necessary to log the response body: with the current implementation, there is no body. In the error cases, the body includes a helpful message explaining the problem, so that's good to have in the logs.
3. This allows us to be more flexible in refactoring `zerovm_query`. I find this large method difficult to reason about in its entirety, and I would like to break it up into a handful of smaller methods.