Skip to content

Commit

Permalink
Merge 4bda0fa into c8da665
Browse files Browse the repository at this point in the history
  • Loading branch information
robertzk committed Aug 24, 2017
2 parents c8da665 + 4bda0fa commit 673e981
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions 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.
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion R/registry.R
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions tests/testthat/test-registry.R
Expand Up @@ -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))
})
})

Expand Down

0 comments on commit 673e981

Please sign in to comment.