Set status of json response on error