-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Description
In this example of exit handlers the complete output is not shown in the html version of the book.
Lines 959 to 974 in 63ea8d9
| ```{r, error = TRUE} | |
| j06 <- function(x) { | |
| cat("Hello\n") | |
| on.exit(cat("Goodbye!\n"), add = TRUE) | |
| if (x) { | |
| return(10) | |
| } else { | |
| stop("Error") | |
| } | |
| } | |
| j06(TRUE) | |
| j06(FALSE) | |
| ``` |
In the printed version of the book, the output correclty shows
j06(FALSE)
#> Hello
#> Error in j06(FALSE): Error
#> Goodbye!
However, the online version of the book, doesn't print anything after the error is thrown.
When running the function in the R console the "Goodbye" string is indeed printed, but not when doing it in a Rmarkdown document.
Since the whole point of this example was to show that exit handlers do something after a function exits on an error, I think it would be interesting to correct the output on the online version of the book.
Metadata
Metadata
Assignees
Labels
No labels