On error, don't assume body matches content type

Closes #55, and generally makes the error handling a bit more bulletproof.