Skip to content

Commit

Permalink
More helpful error message (#179)
Browse files Browse the repository at this point in the history
I had the pleasure of experiencing these mishaps recently and I had a pretty hard time figuring out what the error message meant. I think this would help.

I copied the `sprintf()` approach from the most similar, existing error message. I can't figure out the best way to style this, but I guess this is OK.
  • Loading branch information
jennybc authored and gaborcsardi committed Feb 16, 2019
1 parent ea284a9 commit 5ec7546
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions R/check.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ check_proc <- function(pkgdir, pkgname, version = c("old", "new")) {
dir <- dir_find(pkgdir, "check", pkgname)
tarball <- dir(dir, pattern = "\\.tar\\.gz$", full.names = TRUE)
if (length(tarball) > 1) {
stop("Internal error, multiple source packages?")
stop(sprintf(
"Internal error for package %s. Multiple *.tar.gz files found.",
pkgname
), call. = FALSE)
} else if (length(tarball) == 0) {
stop("Internal error, no source package, download failed?")
stop(sprintf(
"Internal error for package %s. No *.tar.gz file found.",
pkgname
), call. = FALSE)
}

out <- file.path(dir, version)
Expand Down

0 comments on commit 5ec7546

Please sign in to comment.