Skip to content

Commit b1e2f5a

Browse files
committed
better LiblineaR specific penalty error
1 parent 61c452d commit b1e2f5a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

R/logistic_reg.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,10 @@ check_args.logistic_reg <- function(object, call = rlang::caller_env()) {
154154
)
155155
}
156156

157-
if (all(is.numeric(args$penalty)) && !all(args$penalty > 0)) {
157+
if ((!is.null(args$penalty)) && args$penalty <= 0) {
158158
cli::cli_abort(
159-
"For the {.pkg LiblineaR} engine, {.arg penalty} must be {.code > 0}.",
159+
"For the {.pkg LiblineaR} engine, {.arg penalty} must be {.code > 0}, \\
160+
not {args$penalty}.",
160161
call = call
161162
)
162163
}

tests/testthat/_snaps/logistic_reg.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@
6969
fit(spec, Class ~ ., lending_club)
7070
Condition
7171
Error in `fit()`:
72-
! For the LiblineaR engine, `penalty` must be `> 0`.
72+
! For the LiblineaR engine, `penalty` must be `> 0`, not 0.
7373

0 commit comments

Comments
 (0)