As in JS and Python: ```r my_gen <- generator(function() { tryCatch( 1 + "", error = function(cnd) yield("handled") ) }) ``` The error handler should be a separate nested state machine. When entered, the handler is popped off the stack of active handlers.