Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tryCatch not firing #2

Open
Btibert3 opened this issue Jun 29, 2014 · 0 comments
Open

tryCatch not firing #2

Btibert3 opened this issue Jun 29, 2014 · 0 comments

Comments

@Btibert3
Copy link

Admittedly I am not 100% sure if this could be handled better on my end, but I am attempting to handle errors with tryCatch.

The code below does not successfully catch the error.

  tweets = tryCatch(readTweets(FILE), 
                    error = function(e) e)
  if (inherits(tweets, "error")) {
    cat("file not could be parsed\n")
    next
  }

I have this code in a loop, where FILE is represented by the this file.

Here is the error that I get:

> tweets = tryCatch(readTweets(FILE), 
+                   error = function(e) e)
0 tweets have been parsed. 
Warning message:
In readLines(tweets, encoding = "UTF-8") :
  incomplete final line found on '/home/brock/github/uga-twitter-bot/tweets//uga_06-27-2014-17-24.json'
> tweets
list()

As you can see in the FILE's contents, it appears that the service was disrupted temporarily.

I raise this issue because I am wondering if my tryCatch doesn't fire because the error occurs during the readLines call within readTweets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant