[Twisted-Python] twisted.protocols.basic.NetstringReceiver: Some errors are not visible

Carlos Valiente superdupont at gmail.com
Tue Apr 6 04:47:48 MDT 2010


>From twisted/protocols/basic.py:

    class NetstringReceiver(protocol.Protocol):

        def doLength(self):
            ...
            raise NetstringParseError, "netstring too long"
            ...

        def dataReceived(self, data):
            ...
            try:
                ...
                self.doLength()
                ...
            except NetstringParseError:
                self.transport.loseConnection()
                self.brokenPeer = 1

The error message "netstring too long" is shadowed by the except
block. I'd like to see it in my log files.

Would it make sense to emit logging messaged for those errors, or is
there any particular reason why they are silenced?

Cheers,

Carlos




More information about the Twisted-Python mailing list