diff --git a/R/use_msrv.R b/R/use_msrv.R index 2e3a8132..c784eb3f 100644 --- a/R/use_msrv.R +++ b/R/use_msrv.R @@ -17,12 +17,18 @@ #' use_msrv <- function(version = NULL, path = "."){ - if (is.null(version)){ + if (length(version) != 1L) { + cli::cli_abort("Version must be a character scalar", class = "rextendr_error") + } + + msrv_call <- rlang::caller_call() + version <- tryCatch(numeric_version(version), error = function(e) { cli::cli_abort( - "Minimum supported Rust {.arg version} not specified.", - class = "rextendr_error" + "Invalid version provided", + class = "rextendr_error", + call = msrv_call ) - } + }) desc_path <- rprojroot::find_package_root_file("DESCRIPTION", path = path)