File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -108,19 +108,24 @@ ensure_named <- function(pos,
108
108
error_arg = NULL ,
109
109
call = caller_env()) {
110
110
check_empty(pos , allow_empty , error_arg , call = call )
111
-
112
111
113
112
if (! allow_rename && any(names2(pos ) != " " )) {
114
- msg <- " Can't rename variables in this context."
115
- # Add more context if error_arg is supplied.
116
- if (! is.null(error_arg )) {
117
- msg <- c(msg , " i" = " {.arg {error_arg}} can't be renamed." )
113
+ if (is.null(error_arg )) {
114
+ cli :: cli_abort(
115
+ " Can't rename variables in this context." ,
116
+ class = " tidyselect:::error_disallowed_rename" ,
117
+ call = call
118
+ )
119
+ } else {
120
+ cli :: cli_abort(
121
+ c(
122
+ " Can't rename variables in this context." ,
123
+ i = " {.arg {error_arg}} can't be renamed."
124
+ ),
125
+ class = " tidyselect:::error_disallowed_rename" ,
126
+ call = call
127
+ )
118
128
}
119
- cli :: cli_abort(
120
- msg ,
121
- class = " tidyselect:::error_disallowed_rename" ,
122
- call = call
123
- )
124
129
}
125
130
126
131
nms <- names(pos ) <- names2(pos )
You can’t perform that action at this time.
0 commit comments