errors are now sanitized in the app by default (must use options(shiny.sanitize.errors = FALSE) to override this behavior)

This commit is contained in:
Barbara Borges Ribeiro
2016-03-30 07:29:58 +01:00
parent c7eb7ba861
commit afbb17d428
2 changed files with 19 additions and 0 deletions

View File

@@ -96,6 +96,12 @@ NULL
#' an arguably more intuitive arrangement for casual R users, as the name
#' of a function appears next to the srcref where it is defined, rather than
#' where it is currently being called from.}
#' \item{shiny.sanitize.errors}{If \code{TRUE} (the default), then normal
#' errors (i.e errors generated by \code{stop}) won't show up in the app; a
#' simple generic error message is printed instead (the error and strack trace
#' printed to the console remain unchanged). If you want this behavior in
#' general, but you DO want a particular error message to get displayed to the
#' user, please use \code{stopWithCondition} instead.}
#' }
#' @name shiny-options
NULL
@@ -592,6 +598,13 @@ ShinySession <- R6Class(
if (isTRUE(getOption("show.error.messages"))) {
printError(cond)
}
if (getOption("shiny.sanitize.errors", TRUE)) {
cond$message <- paste("An error has occurred. Check your logs or contact",
"the app author for clarification.")
} else {
cond$message <- paste0("Error in output$", name, ": ",
conditionMessage(cond), "\n")
}
invisible(structure(msg, class = "try-error", condition = cond))
},
finally = {