Simplify HTTP error handling

All of the error handlers return the same data structure. The other difference between them is the content, all of which is containing in the error object. This allows for all of the errors to be handled by the same function.
Merge pull request #2 from dirn/patch-2

Simplify HTTP error handling