From 3461c330b205554593b89187e9adae250cb54e8e Mon Sep 17 00:00:00 2001 From: June Choe Date: Mon, 23 Oct 2023 14:58:27 -0400 Subject: [PATCH] col_exists() only fails and never errors for missing column selection --- R/col_exists.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/col_exists.R b/R/col_exists.R index ff1723630..0fa0b3c60 100644 --- a/R/col_exists.R +++ b/R/col_exists.R @@ -241,7 +241,11 @@ col_exists <- function( } # Resolve the columns based on the expression - columns <- resolve_columns(x = x, var_expr = columns, preconditions = NULL) + ## Only for `col_exists()`: error gracefully if column not found + columns <- tryCatch( + expr = resolve_columns(x = x, var_expr = columns, preconditions = NULL), + error = function(cnd) cnd$i %||% NA_character_ + ) if (is_a_table_object(x)) {