Ensure all errors returns a parseable body

Returns parsable (either JSON or XML) body in case of error with status
and error information.

Fixes #365