From fc95ea7dcaefdffa8dbed94ef60ef116fc393102 Mon Sep 17 00:00:00 2001 From: Joe Cheng Date: Mon, 14 Dec 2015 11:04:08 -0800 Subject: [PATCH] stopApp(stop(err)) should cause runApp to throw --- R/server.R | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/R/server.R b/R/server.R index 69bb5a740..9c7a97888 100644 --- a/R/server.R +++ b/R/server.R @@ -668,7 +668,10 @@ runApp <- function(appDir=getwd(), } ) - return(.globals$retval) + if (inherits(.globals$retval, "try-error")) + stop(attr(.globals$retval, "condition", exact = TRUE)) + else + return(.globals$retval) } #' Stop the currently running Shiny app @@ -681,7 +684,7 @@ runApp <- function(appDir=getwd(), #' #' @export stopApp <- function(returnValue = NULL) { - .globals$retval <- returnValue + .globals$retval <- try(force(returnValue), silent = TRUE) .globals$stopped <- TRUE httpuv::interrupt() }