Skip to content
Prev 62191 / 63424 Next

Get list of active calling handlers?

The SO post https://stackoverflow.com/q/77943180 tried to call 
globalCallingHandlers() from a function, and it failed with the error 
message "should not be called with handlers on the stack".  A much 
simpler illustration of the same error comes from this line:

   try(globalCallingHandlers(warning = function(e) e))

The problem here is that try() sets an error handler, and 
globalCallingHandlers() sees it and aborts.

If I call globalCallingHandlers() with no arguments, I get a list of 
currently active global handlers.  Is there also a way to get a list of 
active handlers, including non-global ones (like the one try() added in 
the line above)?

Duncan Murdoch