Learn R Programming

drake (version 4.4.0)

diagnose: Function diagnose

Description

Get the last stored error of a target that failed to build. This target could be a completely failed target or a target that failed initially, retried, then succeeded. If no target is given, then diagnose() simply lists the targets for which a error is retrievable. Together, functions failed() and diagnose() should eliminate the strict need for ordinary error messages printed to the console.

Usage

diagnose(target = NULL, character_only = FALSE, path = getwd(),
  search = TRUE, cache = drake::get_cache(path = path, search = search,
  verbose = verbose), verbose = TRUE)

Arguments

target

name of the target of the error to get. Can be a symbol if character_only is FALSE, must be a character if character_only is TRUE.

character_only

logical, whether target should be treated as a character or a symbol. Just like character.only in library().

path

Root directory of the drake project, or if search is TRUE, either the project root or a subdirectory of the project.

search

If TRUE, search parent directories to find the nearest drake cache. Otherwise, look in the current working directory only.

cache

optional drake cache. See codenew_cache(). If cache is supplied, the path and search arguments are ignored.

verbose

whether to print console messages

See Also

failed, progress, readd, workplan, make

Examples

Run this code
# NOT RUN {
diagnose()
f <- function(){
  stop("unusual error")
}
bad_plan <- workplan(my_target = f())
make(bad_plan)
failed() # from the last make() only
diagnose() # from all previous make()'s
error <- diagnose(my_target)
str(error)
error$calls # View the traceback.
# }

Run the code above in your browser using DataLab