Created
February 23, 2017 18:27
-
-
Save nathan-russell/52255e2470feb1d49e551ad7d28f3792 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f <- function(x) if (x == "France") stop("error") else cat("success\n") | |
for (country in c("France","USA", "Germany")) { | |
tryCatch({ | |
f(country) | |
}, error = function(e) { | |
cat("failed on ", country, "\n") | |
}) | |
} | |
# failed on France | |
# success | |
# success |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment