Skip to content

Commit 9c14988

Browse files
committed
improve error messages for the new theme argument behavior
Don't show the call in this case so that it is clearer for the user.
1 parent 64072eb commit 9c14988

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

R/html_dependencies.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ resolve_theme <- function(theme) {
9191
# Bootstrap/Bootswatch 3 names (backwards-compatibility)
9292
if (is.character(theme)) {
9393
if (length(theme) != 1) {
94-
stop("`theme` must be character vector of length 1.")
94+
stop("`theme` must be character vector of length 1.", call. = FALSE)
9595
}
9696
if (theme %in% c("bootstrap", "default")) {
9797
return("bootstrap")
@@ -100,17 +100,17 @@ resolve_theme <- function(theme) {
100100
}
101101
if (is.list(theme)) {
102102
if (!is_available("bslib")) {
103-
stop("Providing a list to `theme` requires the bslib package.")
103+
stop("Providing a list to `theme` requires the bslib package.", call. = FALSE)
104104
}
105105
return(as_bs_theme(theme))
106106
}
107107
stop(
108-
"`theme` expects any one of the following values: ",
109-
"(1) NULL (no Bootstrap), ",
110-
"(2) a character string referencing a Bootswatch 3 theme name, ",
111-
"(3) a list of arguments to bslib::bs_theme(), ",
112-
"(4) a bslib::bs_theme() object."
113-
)
108+
"`theme` expects any one of the following values: \n",
109+
" (1) NULL (no Bootstrap), \n",
110+
" (2) a character string referencing a Bootswatch 3 theme name, \n",
111+
" (3) a list of arguments to bslib::bs_theme(), \n",
112+
" (4) a bslib::bs_theme() object."
113+
, call. = FALSE)
114114
}
115115

116116
# At the moment, theme may be either NULL (no Bootstrap), a string (Bootswatch

0 commit comments

Comments
 (0)