Skip to content

Commit 002837e

Browse files
authored
correct formatting in model registration error (#1202)
1 parent a9889f0 commit 002837e

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

R/aaa_models.R

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ is_discordant_info <- function(model, mode, eng, candidate,
796796
if (component == "predict" & !is.null(pred_type)) {
797797

798798
current <- dplyr::filter(current, type == pred_type)
799-
p_type <- paste0("and prediction type '", pred_type, "'")
799+
p_type <- "and prediction type {.val {pred_type}} "
800800
} else {
801801
p_type <- ""
802802
}
@@ -809,9 +809,12 @@ is_discordant_info <- function(model, mode, eng, candidate,
809809

810810
if (!same_info) {
811811
cli::cli_abort(
812-
"The combination of engine {.var {eng}} and mode {.var {mode}} \\
813-
{.val {p_type}} already has {component} data for model {.var {model}} \\
814-
and the new information being registered is different.",
812+
paste0(
813+
"The combination of engine {.var {eng}} and mode {.var {mode}} ",
814+
p_type,
815+
"already has {component} data for model {.var {model}}
816+
and the new information being registered is different."
817+
),
815818
call = call
816819
)
817820
}

tests/testthat/_snaps/re_registration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
keeptrees = TRUE, keepcall = FALSE)))
88
Condition
99
Error in `set_fit()`:
10-
! The combination of engine `dbarts` and mode `regression` "" already has fit data for model `bart` and the new information being registered is different.
10+
! The combination of engine `dbarts` and mode `regression` already has fit data for model `bart` and the new information being registered is different.
1111

1212
# re-registration of encoding information
1313

@@ -17,7 +17,7 @@
1717
allow_sparse_x = FALSE))
1818
Condition
1919
Error in `set_encoding()`:
20-
! The combination of engine `dbarts` and mode `regression` "" already has encoding data for model `bart` and the new information being registered is different.
20+
! The combination of engine `dbarts` and mode `regression` already has encoding data for model `bart` and the new information being registered is different.
2121

2222
# re-registration of prediction information
2323

@@ -27,5 +27,5 @@
2727
args = list(obj = quote(object), new_data = quote(new_data), type = "tuba")))
2828
Condition
2929
Error in `set_pred()`:
30-
! The combination of engine `dbarts` and mode `regression` "and prediction type 'numeric'" already has predict data for model `bart` and the new information being registered is different.
30+
! The combination of engine `dbarts` and mode `regression` and prediction type "numeric" already has predict data for model `bart` and the new information being registered is different.
3131

0 commit comments

Comments
 (0)