From 7257fb52b9b2dfe9974c2e7795155f57a9fd6168 Mon Sep 17 00:00:00 2001 From: mrcaseb Date: Fri, 6 Sep 2024 08:59:03 +0200 Subject: [PATCH] fail nicely --- R/update_pbp_participation.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/update_pbp_participation.R b/R/update_pbp_participation.R index d1657a44..57671e0d 100644 --- a/R/update_pbp_participation.R +++ b/R/update_pbp_participation.R @@ -60,9 +60,14 @@ release_pbp_participation <- function(season) { } progressr::with_progress({ - plays <- obtain_plays() + plays <- purrr::possibly(obtain_plays)() }) + if (nrow(plays) == 0){ + cli::cli_alert_warning("Can't access data. Quitting here.") + return(invisible(FALSE)) + } + plays <- plays |> dplyr::mutate( game_id = as.character(game_id),