Aliases: check_dots_used
Keywords:
### ** Examples f <- function(...) { check_dots_used() g(...) } g <- function(x, y, ...) { x + y } f(x = 1, y = 2)
[1] 3
try(f(x = 1, y = 2, z = 3))
Error in f(x = 1, y = 2, z = 3) : Arguments in `...` must be used. ✖ Problematic argument: • z = 3 ℹ Did you misspell an argument name?
try(f(x = 1, y = 2, 3, 4, 5))
Error in f(x = 1, y = 2, 3, 4, 5) : Arguments in `...` must be used. ✖ Problematic arguments: • ..1 = 3 • ..2 = 4 • ..3 = 5 ℹ Did you misspell an argument name?
# Use an `error` handler to handle the error differently. # For instance to demote the error to a warning: fn <- function(...) { check_dots_empty( error = function(cnd) { warning(cnd) } ) "out" } fn()
[1] "out"