Skip to content

Commit

Permalink
Now a more informative error message is produced if a batchtools *.tmpl
Browse files Browse the repository at this point in the history
template file was not found.
  • Loading branch information
HenrikBengtsson committed Apr 25, 2019
1 parent 7648d28 commit f09c487
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
Package: future.batchtools
==========================

Version: 0.7.2-9000 [2019-03-15]
Version: 0.7.2-9000 [2019-04-25]

NEW FEATURES:

* Debug messages are now prepended with a timestamp.

* Now a more informative error message is produced if a batchtools *.tmpl
template file was not found.

BUG FIXES:

* Argument 'workers' could not be a function.
Expand Down
9 changes: 8 additions & 1 deletion R/batchtools_template.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ batchtools_by_template <- function(expr, envir = parent.frame(),
## Tweaked search for template file
findTemplateFile <- import_batchtools("findTemplateFile", default = NA)
if (!identical(findTemplateFile, NA)) {
template <- tryCatch({
pathname <- tryCatch({
findTemplateFile(template)
}, error = function(ex) {
## Try to find it in this package?
Expand All @@ -165,6 +165,13 @@ batchtools_by_template <- function(expr, envir = parent.frame(),
}
stop(ex)
})

if (is.na(pathname)) {
stop(sprintf("Failed to locate a batchtools template file: *%s.tmpl",
template))
}

template <- pathname
}

cluster.functions <- make_cfs(template)
Expand Down

0 comments on commit f09c487

Please sign in to comment.