Skip to content

Commit f09c487

Browse files
Now a more informative error message is produced if a batchtools *.tmpl
template file was not found.
1 parent 7648d28 commit f09c487

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

NEWS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
Package: future.batchtools
22
==========================
33

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

66
NEW FEATURES:
77

88
* Debug messages are now prepended with a timestamp.
99

10+
* Now a more informative error message is produced if a batchtools *.tmpl
11+
template file was not found.
12+
1013
BUG FIXES:
1114

1215
* Argument 'workers' could not be a function.

R/batchtools_template.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ batchtools_by_template <- function(expr, envir = parent.frame(),
154154
## Tweaked search for template file
155155
findTemplateFile <- import_batchtools("findTemplateFile", default = NA)
156156
if (!identical(findTemplateFile, NA)) {
157-
template <- tryCatch({
157+
pathname <- tryCatch({
158158
findTemplateFile(template)
159159
}, error = function(ex) {
160160
## Try to find it in this package?
@@ -165,6 +165,13 @@ batchtools_by_template <- function(expr, envir = parent.frame(),
165165
}
166166
stop(ex)
167167
})
168+
169+
if (is.na(pathname)) {
170+
stop(sprintf("Failed to locate a batchtools template file: *%s.tmpl",
171+
template))
172+
}
173+
174+
template <- pathname
168175
}
169176

170177
cluster.functions <- make_cfs(template)

0 commit comments

Comments
 (0)