I propose the following, simple change to provide users with a more informative error message in such cases.
is_q2metadata <- function(file){
if (!file.exists(file)){stop("Input metadata file (",file,") not found. Please check path and/or use list.files() to see files in current working directory.")}
suppressWarnings(
if(grepl("^#q2:types", readLines(file)[2])){return(TRUE)}else{return(FALSE)}
)
}
Desired behavior would be to output a more useful error message.
Currently, the following code
produces the following error if file
metadata.tsv
doesn't exist:which is not very informative. This is due to the fact that there is no check for existence of a file in the body of
is_q2metadata
function.I propose the following, simple change to provide users with a more informative error message in such cases.