[Twisted-Python] Appropriate exception for AMP types receiving garbage?

Laurens Van Houtven _ at lvh.cc
Wed Dec 26 16:43:30 EST 2012


I'm writing a custom AMP type. I noticed that when writing the unit test
for garbage input, I didn't really know what exception to check for.

I couldn't find any place where this was formally defined, so I checked for
implementation behavior. Boolean explicitly raises TypeError. Integer
raises ValueError, but that appears to only be an implementation detail of

It could also be that it doesn't matter at all, but it does seem a little
strange that Integer and Boolean raise different exceptions when fed

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20121226/35966a15/attachment.htm 

More information about the Twisted-Python mailing list