Adds code to properly handle errors in the response received back from
the Hanlon server correctly (will throw an error rather than trying to
handle the HTML that comes back from the server as if it were JSON)