Try functions to capture warnings, errors and messages.
This function combines the base functions tryCatch()
and
withCallingHandlers()
for the specific purpose of capturing
not only errors and warnings but messages as well.
tryCatchWEM(expr, capture = FALSE)
expr |
Expression to be evaluated. |
capture |
Logical, capture the visible output. |
In some situations it might be important not only to test a function, but also to capture everything that is written in the R console, be it an error, a warning or simply a message.
For instance package QCA (version 3.4) has a Graphical User Interface that simulates an R console embedded into a web based shiny app.
It is not intended to replace function tryCatch()
in any
way, especially not evaluating an expression before returning or exiting, it simply
captures everything that is printed on the console (the visible output).
A list, if anything would be printed on the screen, or an empty (NULL) object otherwise.
Adrian Dusa
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.