Skip to content

Commit ae7bbf6

Browse files
committed
Update custom error message
1 parent 90a50fa commit ae7bbf6

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

R/errors.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ create_type_check_error_message <- function(error) {
2727
paste("type:", typeof(value)),
2828
paste("class:", class_text),
2929
paste("length:", length(value)),
30-
ifelse(is.null(error$msg), paste("expected:", fn_text), error$msg)
30+
ifelse(is.null(error$msg), paste("expected:", fn_text), glue::glue(error$msg))
3131
)
3232
return(msg)
3333
}

R/types.R

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@
1818
is_any <- function(x) TRUE
1919

2020
# ---
21-
# DEPRECATED
22-
#Any <- function(n = NULL) {
23-
# if (is.null(x)) {
24-
# return(is_any)
25-
# }
26-
# return(function(x) length(x) == n)
27-
#}
28-
2921
#' Type predicate `typewriter model`
3022
#' @param model_fn A model factory function created with [base_model()].
3123
#' @export
@@ -56,7 +48,7 @@ create_model_field <- function(
5648
base_fn <- is_logical
5749
}
5850

59-
error_msg <- paste("value must be of type", dtype)
51+
error_msg <- paste("value of '{error$name}' must be of type", dtype)
6052
check_type <- base_fn
6153
if (is_not_null(n)) {
6254
error_msg <- paste0(error_msg, "(", n, ")")

0 commit comments

Comments
 (0)