Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use a restart to handle stop_on_error = 2L #232

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
3 changes: 2 additions & 1 deletion R/conditions.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ condition_handlers <- function(watcher, on_error, on_warning, on_message) {
switch(on_error,
continue = invokeRestart("eval_continue"),
stop = invokeRestart("eval_stop"),
error = invokeRestart("eval_error", cnd)
# No need to invoke a restart as we want the error to be thrown in this case.
error = NULL
)
}
)
Expand Down
3 changes: 1 addition & 2 deletions R/evaluate.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ evaluate <- function(input,
handlers
),
eval_continue = function() TRUE,
eval_stop = function() FALSE,
eval_error = function(cnd) {signalCondition(cnd); stop(cnd)}
eval_stop = function() FALSE
)
watcher$check_devices()

Expand Down
11 changes: 11 additions & 0 deletions tests/testthat/_snaps/conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,15 @@
Condition
Error:
! 1
Output
<evaluation>
Source code:
stop("1")
Condition:
Error:
1
Source code:
2
Text output:
[1] 2

Loading