databio / simpleCache

Simplified R caching for reproducible big data projects
http://code.databio.org/simpleCache/
Other
34 stars 6 forks source link

Modify error message when cache does not exist #44

Open j-lawson opened 5 years ago

j-lawson commented 5 years ago

When trying to load a cache and that cache does not exist and there is no code given to generate a new cache, the following error is given:

"Error in doTryCatch(return(expr), name, parentenv, handler) : ::Error:: If you do not provide an instruction argument, you must set global option RBUILD.DIR with setCacheBuildDir, or specify abuildDir parameter directly to simpleCache()."

This could happen if simpleCache is being used only for loading a cache into R as part of a script (not creating a new cache) but the cache name has changed. It would be helpful if the error message mentioned that a cache with the given name does not exist.

library(simpleCache)
setCacheDir(getwd()) 
 simpleCache("wrongname")

Session info:

R version 3.5.3 (2019-03-11) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.6 LTS

Matrix products: default BLAS: /usr/lib/libblas/libblas.so.3.6.0 LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] grid parallel stats4 stats graphics grDevices utils datasets methods base

other attached packages: [1] COCOA_1.0.1 folderfun_0.1.1 MultiAssayExperiment_1.8.1 SummarizedExperiment_1.12.0 DelayedArray_0.8.0
[6] BiocParallel_1.16.5 matrixStats_0.54.0 Biobase_2.42.0 gridExtra_2.3 ComplexHeatmap_1.20.0
[11] MIRA_1.4.1 RGenomeUtils_0.01 ggplot2_3.1.0 simpleCache_0.3.1 data.table_1.12.0
[16] GenomicRanges_1.34.0 GenomeInfoDb_1.18.1 IRanges_2.16.0 S4Vectors_0.20.1 BiocGenerics_0.28.0
[21] LOLA_1.12.0

loaded via a namespace (and not attached): [1] Rcpp_1.0.0 locfit_1.5-9.1 circlize_0.4.5 lattice_0.20-38 tidyr_0.8.2 Rsamtools_1.34.1
[7] Biostrings_2.50.2 gtools_3.8.1 assertthat_0.2.0 R6_2.3.0 plyr_1.8.4 pillar_1.3.1
[13] GlobalOptions_0.1.0 zlibbioc_1.28.0 rlang_0.3.1 lazyeval_0.2.1 rstudioapi_0.9.0 GetoptLong_0.1.7
[19] R.utils_2.7.0 R.oo_1.22.0 Matrix_1.2-17 stringr_1.3.1 RCurl_1.95-4.11 munsell_0.5.0
[25] bsseq_1.18.0 HDF5Array_1.10.1 compiler_3.5.3 rtracklayer_1.42.1 pkgconfig_2.0.2 shape_1.4.4
[31] tidyselect_0.2.5 tibble_2.0.1 GenomeInfoDbData_1.2.0 XML_3.98-1.16 permute_0.9-4 crayon_1.3.4
[37] dplyr_0.7.8 withr_2.1.2 GenomicAlignments_1.18.1 bitops_1.0-6 R.methodsS3_1.7.1 gtable_0.2.0
[43] magrittr_1.5 scales_1.0.0 stringi_1.2.4 XVector_0.22.0 reshape2_1.4.3 bindrcpp_0.2.2
[49] limma_3.38.3 DelayedMatrixStats_1.4.0 RColorBrewer_1.1-2 rjson_0.2.20 Rhdf5lib_1.4.2 tools_3.5.3
[55] BSgenome_1.50.0 glue_1.3.0 purrr_0.3.0 colorspace_1.4-0 rhdf5_2.26.2 bindr_0.1.1