From 213ee7be135a05eae4b4df92c0a3bad9547b4f86 Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Tue, 26 Sep 2017 14:23:38 -0500 Subject: [PATCH] Quote arguments to do.call() for nicer stack traces. Closes #1851 --- NEWS.md | 2 ++ R/app.R | 5 +++-- R/render-plot.R | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index e48f38067..507df4608 100644 --- a/NEWS.md +++ b/NEWS.md @@ -15,6 +15,8 @@ shiny 1.0.5.9000 * Addressed [#1784](https://github.com/rstudio/shiny/issues/1784): `runApp()` will avoid port 6697, which is considered unsafe by Chrome. +* Addressed [#1851](https://github.com/rstudio/shiny/issues/1851): Stack traces are now smaller in some places `do.call()` is used. ([#1856](https://github.com/rstudio/shiny/pull/1856)) + ### Bug fixes * The internal `URLdecode()` function previously was a copy of `httpuv::decodeURIComponent()`, assigned at build time; now it invokes the httpuv function at run time. diff --git a/R/app.R b/R/app.R index 5504a186f..7b7774ef5 100644 --- a/R/app.R +++ b/R/app.R @@ -381,9 +381,10 @@ print.shiny.appobj <- function(x, ...) { c("port", "launch.browser", "host", "quiet", "display.mode", "test.mode")] - args <- c(list(x), opts) + # Quote x and put runApp in quotes so that there's a nicer stack trace (#1851) + args <- c(list(quote(x)), opts) - do.call(runApp, args) + do.call("runApp", args) } #' @rdname shinyApp diff --git a/R/render-plot.R b/R/render-plot.R index a07e470f1..3c0a47b73 100644 --- a/R/render-plot.R +++ b/R/render-plot.R @@ -232,7 +232,7 @@ renderPlot <- function(expr, width='auto', height='auto', res=72, ..., # renderPlot, and by the ..stacktraceon.. in plotFunc where ggplot objects # are printed outfile <- ..stacktraceoff..( - do.call(plotPNG, c(plotFunc, width=dims$width*pixelratio, + do.call("plotPNG", c(quote(plotFunc), width=dims$width*pixelratio, height=dims$height*pixelratio, res=res*pixelratio, args)) ) on.exit(unlink(outfile))