This whole section of code was a mess to start with.  I initially tried to clean it up by wrapping the response with the Response object to help reduce the complexity and encapsulate some of the logic but it turns out that sometimes the response is a string, sometimes it's a hash, and sometimes it's a Response.  <sigh/>  This was the compromise to keep the existing behavior for existing errors.

Basically, it's ripe for refactor but outside of the scope of what I was trying to do.