RStudio error handler mysteriously changed from default handler to a different handler

rstudio

#1

I was going to create an issue on the RStudio github, but then I realized that the deeper issue seems to be that the default RStudio error handler somehow got change on my system to a different one. With a fresh install of RStudio (and after deleting the .rstudio-desktop directory in my home directory), the default error handler is the following:

getOption('error')
#> (function () 
#> {
#>     .rs.recordTraceback(TRUE, 5, .rs.enqueueError)
#> })()

However, at some point recently, something changed my settings so that the following error handler was used:

getOption('error')
#> (function ()
#> {
#>    .rs.breakOnError(FALSE)
#> })()

This setting persists between different R sessions. As far as I can tell, I did not change this setting myself. So my main question is this: What process could have changed the error option on my system to a different internal RStudio handler?

The new error handler worked fine in most scenarios, but I unintentionally created a weird edge case. (It was this edge case that eventually made me realize that the error handler had changed.) In my typical RStudio usage, when an error is encountered, an error message is emitted at the console, and the debugger is NOT started. However, for my scenario, when the error is encountered, the debugger is immediately launched. Here is a minimal example of the problem:

getOption('error')
#> (function ()
#> {
#>    .rs.breakOnError(FALSE)
#> })()

parent <- list2env(list(a = 42, b = list(1, 2, 3), child = NULL))

parent$child <- list2env(list(parent = parent, u = 1001))
class(parent$child) <- 'a'

f <- function(x) UseMethod('f')
f.a <- function(x) x$parent$b[[NULL]]

f(parent$child)
#> Error in x$parent$b[[NULL]] : 
#>    attempt to select less than one element in get1index
#> Called from: f.a(parent$child)

At this point, when f(parent$child) is invoked, the error message is emitted at the console and the debugger is immediately launched with the browser examining the f.a call. Of course, I do not have options(error = recover) set, so I do not want the browser to be automatically launched when this error is encountered. The browser appears to be launched from this bit of code within the .rs.breakOnError function:

System details

RStudio Edition : Desktop
RStudio Version : 1.1.419
OS Version      : Ubuntu Xenial (16.04)
R Version       : 3.4.2

#2

This behavior can be toggled in the main menu:

Does changing back to Error Inspector or Message Only make a difference?


#3

Yeah, that fixes it! The funny thing is, I’m pretty sure I didn’t change that setting from the menu. Though of course it’s certainly possible that I had an errant mouse click that did it without me realizing it…