Use proper status codes to send errors back with JSON.