eventmachine/eventmachine — pull request #278 by gdb (2011-11-13 03:44:54+00:00)
Title: Add dynamic environments to callbacks

This is a pretty alpha patch, but I'm curious whether anyone is interested in this functionality.

My main use-case is for something like the following: an HTTP request is received by an EM server. A series of callbacks happen as backend services are called. An exception is raised in one of them, which bubbles into the global error_handler. At this point, the error_handler would ideally serve a 500 to that request, but it doesn't have enough information to know which pending HTTP request has errored out.

This patch would allow the programmer to store the HTTP request in a dynamic environment, which is accessible from within the error_handler.