Skip to content

Commit

Permalink
tryCatch
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Apr 7, 2024
1 parent fff94f5 commit 1b7596c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions R/autolink.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
.autolink <- function(path = ".") {
# everyting wrapped in tryCatch() because especially error prone with weird pandoc memory errors
html_files <- c(tryCatch(fs::dir_ls(fs::path_join(c(path, "docs/vignettes")), regexp = "\\.html$"), error = function(e) NULL),
tryCatch(fs::dir_ls(fs::path_join(c(path, "docs/man")), regexp = "\\.html$"), error = function(e) NULL))
for (h in html_files) {
downlit::downlit_html_path(h, h)
tmp <- try(downlit::downlit_html_path(h, h), silent = TRUE)
if (inherits(tmp, "try-error")) {
cli::cli_alert_danger(sprintf("Failed to auto-link: %s", h))
}

}
# h <- fs::path_join(c(path, "docs/index.html"))
# if (fs::file_exists(h)) {
Expand All @@ -13,7 +18,10 @@
tryCatch(fs::dir_ls(fs::path_join(c(path, "docs/vignettes")), regexp = "\\.md$"), error = function(e) NULL),
tryCatch(fs::dir_ls(fs::path_join(c(path, "docs/man")), regexp = "\\.md$"), error = function(e) NULL))
for (m in md_files) {
downlit::downlit_md_path(m, m)
tmp <- try(downlit::downlit_md_path(m, m), silent = TRUE)
if (inherits(tmp, "try-error")) {
cli::cli_alert_danger(sprintf("Failed to auto-link: %s", h))
}
}
# m <- fs::path_join(c(path, "docs/README.md"))
# if (fs::file_exists(m)) {
Expand Down

0 comments on commit 1b7596c

Please sign in to comment.