From a1aef0150f35379a6a85f26fef7e1c732925f5b4 Mon Sep 17 00:00:00 2001 From: ShixiangWang Date: Mon, 23 Nov 2020 16:44:16 +0800 Subject: [PATCH] Bump version --- CRAN-RELEASE | 4 ++-- DESCRIPTION | 2 +- NEWS.md | 5 +++++ R/XenaDownload.R | 12 ++++++++++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CRAN-RELEASE b/CRAN-RELEASE index eeb5e05..dfb5deb 100644 --- a/CRAN-RELEASE +++ b/CRAN-RELEASE @@ -1,2 +1,2 @@ -This package was submitted to CRAN on 2020-11-15. -Once it is accepted, delete this file and tag the release (commit 9a9558a). +This package was submitted to CRAN on 2020-11-23. +Once it is accepted, delete this file and tag the release (commit cf0d04f). diff --git a/DESCRIPTION b/DESCRIPTION index b8c2a2f..dbd5c68 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: UCSCXenaTools Title: Download and Explore Datasets from UCSC Xena Data Hubs -Version: 1.3.5 +Version: 1.3.6 Authors@R: c(person("Shixiang", "Wang", email = "w_shixiang@163.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9855-7357")), person("Xue-Song", "Liu", role = "aut", comment = c(ORCID = "0000-0002-7736-0077")), diff --git a/NEWS.md b/NEWS.md index ca23a67..156839b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# UCSCXenaTools 1.3.6 + +- Fixed a bug about try times for data download. +- Make sure a message instead of an error will be returned if download process failed. + # UCSCXenaTools 1.3.5 - Added TDI data Hub containing 9 new datasets. diff --git a/R/XenaDownload.R b/R/XenaDownload.R index 4d9144f..fe76140 100644 --- a/R/XenaDownload.R +++ b/R/XenaDownload.R @@ -92,7 +92,15 @@ XenaDownload <- function(xquery, x[4] <- gsub(pattern = "\\.gz$", "", x[4]) x[5] <- gsub(pattern = "\\.gz$", "", x[5]) message("Try downloading file", x[4], "...") - download.file2(x[3], destfile = x[5], max_try = max_try, ...) + tryCatch( + { + download.file2(x[3], destfile = x[5], max_try = max_try, ...) + }, + error = function(e) { + message("Your network is bad (try again) or the data source is invalid (report to the developer).") + invisible(NULL) + } + ) } ) }) # nocov end @@ -121,7 +129,7 @@ download.file2 <- function(url, destfile, if (max_try == 1) { stop("Tried 3 times but failed, please check your internet connection!") } else { - download.file(url, destfile, max_try = max_try - 1L, ...) + download.file2(url, destfile, max_try = max_try - 1L, ...) } } )