@@ -70,19 +70,24 @@ doFuture2 <- function(obj, expr, envir, data) { #nolint
7070 options [name ] <- opts [name ]
7171 }
7272 options(future.disposable = NULL )
73-
74- errors <- options [[" errors" ]]
75- if (is.null(errors )) {
76- errors <- " future"
77- } else if (is.character(errors )) {
78- if (length(errors ) != 1L ) {
79- stop(sprintf(" Element 'errors' of '.options.future' should be of length one': [n = %d] %s" , length(errors ), paste(sQuote(errors ), collapse = " , " )))
80- }
81- if (! errors %in% c(" future" , " foreach" )) {
82- stop(sprintf(" Unknown value of '.options.future' element 'errors': %s" , sQuote(errors )))
83- }
73+
74+ error_handling <- obj $ errorHandling
75+ if (! identical(error_handling , " stop" )) {
76+ errors <- " foreach"
8477 } else {
85- stop(" Unknown type of '.options.future' element 'errors': " , mode(errors ))
78+ errors <- options [[" errors" ]]
79+ if (is.null(errors )) {
80+ errors <- " future"
81+ } else if (is.character(errors )) {
82+ if (length(errors ) != 1L ) {
83+ stop(sprintf(" Element 'errors' of '.options.future' should be of length one': [n = %d] %s" , length(errors ), paste(sQuote(errors ), collapse = " , " )))
84+ }
85+ if (! errors %in% c(" future" , " foreach" )) {
86+ stop(sprintf(" Unknown value of '.options.future' element 'errors': %s" , sQuote(errors )))
87+ }
88+ } else {
89+ stop(" Unknown type of '.options.future' element 'errors': " , mode(errors ))
90+ }
8691 }
8792
8893
@@ -630,7 +635,6 @@ elements in 'X' (= %d). There were in total %d chunks and %d elements (%s)",
630635 # # ... or as traditionally with %dopar%, which throws an error
631636 # # or return the combined results
632637 # # NOTE: This is adopted from foreach:::doSEQ()
633- error_handling <- obj $ errorHandling
634638 if (debug ) {
635639 mdebugf(" processing errors (handler = %s)" , sQuote(error_handling ))
636640 }
0 commit comments