Add safe event emitting to capture fiber.

Events are emitted, and if the handler raises an error, it is caught and
resent as an "error" event that can be handled with the `on` method interface.