[Twisted-Python] some errors twisted does not handle gracefully

Cory Dodt corydodt at yahoo.com
Tue Feb 5 04:21:08 EST 2002

I'm trying to make a catalog of these.  Twisted needs to have
better-defined exceptions for certain conditions instead of relying on
Python to report the error via tracebacks.  More specific errors would
allow the developer to more quickly track down the problem. 
programmatic handling of exceptions in the client should be feasible. 
Handling a TypeError that could be a bug in your code the same as an
unauthorized-client-action style error means you have to accept that
in your code will be masked if you catch these.

Here's the list:

1) cause: Didn't set 'application' in a config.tac.

results in this message in the log:

"05/02/2002 00:50 [-] Python file
'/home/cdodt/TwistedPlugins/dataconda/config.tac' did not produce an

This isn't gross, but there's no reason not to give more information
 Even though I knew about this requirement, I had forgotten about it and
renamed a variable, resulting in this situation.  The log message wasn't
helpful in reminding me.  It should be just a little more specific:
"config.tac must set a variable named 'application'.  No application was

2) cause: Trying to log in as an Identity that never had a password set

Traceback! exceptions.TypeError, argument must be string or read-only
buffer, not None

This one is pretty ugly.  It's valid to have an Identity with no password.
(If it isn't, then you shouldn't be able to create one.)  In my case,
it just means that user can't log in.  If we must throw an exception
throw "IdentityWithNullPasswordError" or something like that, and better
yet, name the identity with the problem.

3) cause: calling a method with the wrong name on a RemoteReferenced
object (Perspective, Referenceable, etc.)

Traceback! exceptions.AttributeError, LobbyUser instance has no
attribute 'perspective_xxx'

Well ok, duh, at least this one I can figure out.  But it should still
be something more specific: 'RemoteMethodNotImplementedError' for

I will send more as I find them.


Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!

More information about the Twisted-Python mailing list