Skip to content

Add verbose argument in check_variables and check_ct_data #74

@yurovska

Description

@yurovska

During development of ADaM programs, when not all variables existing in the specs have been derived yet, it is so annoying that check_variables function fails with error and stops execution. Same for ongoing work. Someone adds a new variables to the specs and ADaM program no longer works. What's the point to fail with error just because there is one variable not derived? Shouldn't it be a warning?

Same for check_ct_data. We're far away from eSub and do not want to clean up our specs now by adding all CTs etc. We'll do it when ADaM is final. Until then we'd like to see a warning, not an error.

Our temporary solution is to add the following in .Rprofile:

# Suppress errors in ADaM programs coming from {metatools} functions ----

setHook(
  packageEvent("metatools", "onLoad"),
  function(...) {
    check_variables_original <- metatools::check_variables
    environment(check_variables_original) <- asNamespace("metatools")
    
    assignInNamespace(
      "check_variables",
      function(...) {
        tryCatch(
          check_variables_original(...),
          error = function(e) {
            warning(e$message)
          }
        )
      },
      ns = "metatools"
    )
    
    check_ct_data_original <- metatools::check_ct_data
    environment(check_ct_data_original) <- asNamespace("metatools")
    
    assignInNamespace(
      "check_ct_data",
      function(...) {
        tryCatch(
          check_ct_data_original(...),
          error = function(e) {
            warning(e$message)
          }
        )
      },
      ns = "metatools"
    )
  }
)

Metadata

Metadata

Assignees

Labels

0.3.0Issues to be worked on for release 0.3.0 (est. Jan 2026).enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions