Test the error handling of json and html responses