even more error handling

This commit is contained in:
2014-12-01 23:58:40 +01:00
parent 3dae6c0626
commit 4501747a44
2 changed files with 2621 additions and 269 deletions
+8
View File
@@ -59,6 +59,14 @@ for(a in 1:nrow(acc_df)) {
current <- twitter_api_call(api_url, query, api_params) current <- twitter_api_call(api_url, query, api_params)
tweets_temp <- fromJSON(correctJSON(current)) tweets_temp <- fromJSON(correctJSON(current))
status <- length(tweets_temp)
if(status == 0) {
cat("[WARNING] Empty API result. Trying again.\n")
rm(tweets_temp)
Sys.sleep(2)
next
}
# Check if API output contains error fields # Check if API output contains error fields
status <- "error" %in% names(tweets_temp) status <- "error" %in% names(tweets_temp)
if(status) { if(status) {
+2613 -269
View File
File diff suppressed because it is too large Load Diff