Skip to content

Commit d8dc631

Browse files
committed
error handling
1 parent 6f0a537 commit d8dc631

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

R/evalTargetFun.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,13 @@ evalTargetFun.OptState = function(opt.state, xs, extras) {
8080
if (isTRUE(control$noisy.instances > 1L) && control$noisy.self.replicating) {
8181
xs.trafo = rep(xs.trafo, each = control$noisy.instances)
8282
res = lapply(res, function(r) {
83-
lapply(seq_along(r$y), function(i) {
84-
list(y = r$y[i], time = r$time / length(r$y), user.extras = c(r$user.extras, setNames(list(i), control$noisy.instance.param)))
85-
})
83+
if (is.error(r)) {
84+
rep(list(r), control$noisy.instances)
85+
} else {
86+
lapply(seq_along(r$y), function(i) {
87+
list(y = r$y[i], time = r$time / length(r$y), user.extras = c(r$user.extras, setNames(list(i), control$noisy.instance.param)))
88+
})
89+
}
8690
})
8791
res = unlist(res, recursive = FALSE)
8892
}

0 commit comments

Comments
 (0)