From 835745886eef8cca8be21feb7f0d217bf346e3ac Mon Sep 17 00:00:00 2001 From: Joe Cheng Date: Fri, 26 May 2017 08:26:58 -0700 Subject: [PATCH] Make broken expectations catchable by try() Currently, broken expectations break rmarkdown document rendering even if knitr chunk option error=TRUE. It also breaks the evaluate package's ability to capture errors. --- R/expectation.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/expectation.R b/R/expectation.R index 52190a60b..112c72acf 100644 --- a/R/expectation.R +++ b/R/expectation.R @@ -22,6 +22,8 @@ expectation <- function(type, message, srcref = NULL) { class = c( paste0("expectation_", type), "expectation", + # Make broken expectations catchable by try() + if (type %in% c("failure", "error")) "error", "condition" ) )