| safe_execute | R Documentation |
Evaluate code with unified error handling (and consistent warning reporting).
On error, prints a CLI message (unless quiet = TRUE) and returns NULL.
safe_execute(expr, fail_message = "An error occurred", quiet = FALSE)
expr |
Code to evaluate. |
fail_message |
Message to display if an error occurs. Default: "An error occurred". |
quiet |
Logical. If |
The result of the expression if successful; otherwise NULL.
safe_execute(log(1))
safe_execute(log("a"), fail_message = "Failed to compute log")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.