[Rd] Get list of active calling handlers?

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Tue Feb 6 22:31:10 CET 2024


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



More information about the R-devel mailing list