Skip to content

Option to disable purr:safely for easier debugging #269

Description

@ncittm

Strategus executes package functions with the help of purr::safely. While this ensures that Strategus will still succeed even if a single analysis fails, it also hides important error messages that could be useful for debugging.

One way around this is to apply the following diff temporarily:

diff --git a/R/Execution.R b/R/Execution.R
index dc0bcaa..8cc9b3b 100644
--- a/R/Execution.R
+++ b/R/Execution.R
@@ -192,9 +192,9 @@ execute <- function(analysisSpecifications,
 }

 .safeExecution <- function(fn, ...) {
-  safeExec <- purrr::safely(fn)
+  functionResult <- c(error = NULL)
   startTime <- Sys.time()
-  functionResult <- safeExec(...)
+  functionResult$result <- fn(...)
   timeToExecute <- Sys.time() - startTime
   # Emit any errors
   status <- ifelse(is.null(functionResult$error), "SUCCESS", "FAILED")

Would it be useful to enable this functionality via a setting in R's options (or settings)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions