[medusa] more uniform error handling in asyncore.dispatcher() ?
rushing@n...
rushing@n...
Sat, 30 Jan 1999 13:32:13 -0800 (PST)
rushing@n... writes:
> While looking into this, I noticed that a possibly cleaner solution is
> to have the send() and recv() methods in asyncore.dispatcher call
> self.handle_error() directly, instead of re-raising unexpected errors
> that they see. I think this would relieve the responsibility to
> try/except from any derived class.
On second thought, I don't think this is a good idea: it throws
off the ability to exit correctly from a sequence of code:
def method (self):
n = self.send (data)
[...other code...]
If handle_error() is called automatically from send(), then there's no
way for [...other code...] to know about the error condition so that
it might exit the method (or choose a different branch of an if,
etc...)
-Sam
------------------------------------------------------------------------
eGroup home: http://www.eGroups.com/list/medusa
Free Web-based e-mail groups by eGroups.com