Skip to content

Commit 690594c

Browse files
bschilderclaude
andcommitted
Add tryCatch fallback for Bioc download stats (fixes #3)
dlstats::bioc_stats() can error when the Bioconductor stats endpoint is unavailable. Now catches the error gracefully, warns the user, and returns empty results instead of crashing. [skip ci] Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 11da90a commit 690594c

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

R/r_repos_downloads_bioc_dlstats.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,17 @@ r_repos_downloads_bioc_dlstats <- function(pkgs,
1515
messager(paste("Batch:",i,"/",length(batches)),
1616
parallel = TRUE,
1717
v=verbose)
18-
dt <- dlstats::bioc_stats(packages = b,
19-
use_cache = use_cache) |>
18+
dt <- tryCatch({
19+
dlstats::bioc_stats(packages = b,
20+
use_cache = use_cache) |>
21+
data.table::data.table()
22+
}, error = function(e){
23+
messager("WARNING: Bioc download stats ",
24+
"unavailable for this batch: ",
25+
conditionMessage(e),
26+
parallel = TRUE, v=verbose)
2027
data.table::data.table()
28+
})
2129
messager(paste(
2230
"Data for",formatC(nrow(dt),big.mark = ","),
2331
"packages retrieved."

0 commit comments

Comments
 (0)