From murdoch@dunc@n @end|ng |rom gm@||@com  Tue Feb  6 22:31:10 2024
From: murdoch@dunc@n @end|ng |rom gm@||@com (Duncan Murdoch)
Date: Tue, 6 Feb 2024 16:31:10 -0500
Subject: [Rd] Get list of active calling handlers?
Message-ID: <e5f12cfa-7efa-41e8-b152-6e9ef8af39b9@gmail.com>

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



[Rd] Get list of active calling handlers?
Duncan Murdoch