Global error handling in RMarkdown

I'm building a tool to help explain errors. Right now, the tool works as an RStudio addin that opens the viewer pane any time the user encounters an error.

To run code whenever the user hits a top-level, error, I use options:

options(error = my_error_handler)

I would like to do the same thing for RMarkdown, i.e. run an error handler on any uncaught error. However, if I set options(error = ...) in an RMarkdown cell, its effect only persists for a single cell. Example:

Is there a function in the knitr package that's supposed to let me set an error handler on all cells?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.