Catch error when doing HTTP request.