Skip to content

Commit

Permalink
fail nicely
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcaseb committed Dec 3, 2023
1 parent f8cd258 commit 136f8cc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion R/update_playstats.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
save_playstats <- function(season) {

playstats <- nflfastR:::build_playstats(seasons = season)
playstats <- purrr::possibly(
nflfastR:::build_playstats,
otherwise = data.frame(),
quiet = FALSE
)(seasons = season)

if(nrow(playstats) == 0){
cli::cli_alert_warning("Download failed. Gonna abort")
return(NULL)
}

attr(playstats,"nflfastR_version") <- packageVersion("nflfastR")

Expand Down

0 comments on commit 136f8cc

Please sign in to comment.