Catch error on ajax calls that are expected to fail gracefully.