Skip to content

Commit

Permalink
handle the skip directly
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico authored Oct 24, 2024
1 parent a748736 commit cd3bb6d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/skip.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ skip_if <- function(condition, message = NULL) {
#' @rdname skip
skip_if_not_installed <- function(pkg, minimum_version = NULL) {
# most common case: it's not installed
res <- tryCatch(find.package(pkg), error = identity)
if (inherits(res, "error")) {
skip(paste0("{", pkg, "} is not installed"))
}
tryCatch(
find.package(pkg),
error = function(e) skip(paste0("{", pkg, "} is not installed"))
)
# rarer: it's installed, but fails to load
if (!requireNamespace(pkg, quietly = TRUE)) {
skip(paste0("{", pkg, "} cannot be loaded"))
Expand Down

0 comments on commit cd3bb6d

Please sign in to comment.