diff --git a/CHANGELOG.md b/CHANGELOG.md index 1411ddf..7204938 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.0.5.9005 + +* Return `NULL` in registry getting regardless of error. + ## 0.3.0.5.9004 * Fix usage of `base` parameter in `$find` method with idempotent resources. diff --git a/DESCRIPTION b/DESCRIPTION index daafca6..b80cade 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -5,7 +5,7 @@ Description: Director is responsible for managing and loading resources in consecutive loads of resources (so that we can tell if a script was modified since we last ran it) and defining parsers that allow us to generalize from the pernicious simple linear execution that is common to R. -Version: 0.3.0.5.9004 +Version: 0.3.0.5.9005 Authors@R: c(person("Robert", "Krzyzanowski", email = "technoguyrob@gmail.com", role = c("aut", "cre"))) Depends: diff --git a/R/registry.R b/R/registry.R index 7e1d243..279be09 100644 --- a/R/registry.R +++ b/R/registry.R @@ -166,7 +166,8 @@ registry <- methods::setRefClass('registry', sQuote(crayon::red(key)), " in registry with root ", sQuote(crayon::blue(.root))) } else if (file.info(filename)$isdir) { - stop("There is no registry item with key ", sQuote(crayon::red(key)), + if (soft) NULL + else stop("There is no registry item with key ", sQuote(crayon::red(key)), " in registry with root ", sQuote(crayon::blue(.root)), " because this key points to a directory.") } else filename diff --git a/tests/testthat/test-registry.R b/tests/testthat/test-registry.R index bde3217..c674b5c 100644 --- a/tests/testthat/test-registry.R +++ b/tests/testthat/test-registry.R @@ -62,8 +62,7 @@ within_file_structure(list(), { test_that('the .sanitize_key method errors if read = TRUE and the key is a directory', { within_file_structure(dir = root, list(some_dir = list()), { - expect_error(registry(root)$.sanitize_key('some_dir', read = TRUE), - 'this key points to a directory') + expect_null(registry(root)$.sanitize_key('some_dir', read = TRUE, soft = TRUE)) }) })