Output JSON error messages
Raise error when HTTP response was bad