diff options
Diffstat (limited to 'pysnmp/carrier/twisted')
-rw-r--r-- | pysnmp/carrier/twisted/dgram/base.py | 8 | ||||
-rw-r--r-- | pysnmp/carrier/twisted/dgram/udp.py | 8 | ||||
-rw-r--r-- | pysnmp/carrier/twisted/dgram/unix.py | 8 |
3 files changed, 12 insertions, 12 deletions
diff --git a/pysnmp/carrier/twisted/dgram/base.py b/pysnmp/carrier/twisted/dgram/base.py index 4995aec4..4386b702 100644 --- a/pysnmp/carrier/twisted/dgram/base.py +++ b/pysnmp/carrier/twisted/dgram/base.py @@ -32,8 +32,8 @@ class DgramTwistedTransport(DatagramProtocol, AbstractTwistedTransport): debug.logger & debug.flagIO and debug.logger('startProtocol: transportAddress %r outgoingMessage %s' % (transportAddress, debug.hexdump(outgoingMessage))) try: self.transport.write(outgoingMessage, transportAddress) - except Exception: - raise error.CarrierError('Twisted exception: %s' % (sys.exc_info()[1],)) + except Exception as exc: + raise error.CarrierError('Twisted exception: %s' % exc) def stopProtocol(self): debug.logger & debug.flagIO and debug.logger('stopProtocol: invoked') @@ -45,5 +45,5 @@ class DgramTwistedTransport(DatagramProtocol, AbstractTwistedTransport): else: try: self.transport.write(outgoingMessage, transportAddress) - except Exception: - raise error.CarrierError('Twisted exception: %s' % (sys.exc_info()[1],)) + except Exception as exc: + raise error.CarrierError('Twisted exception: %s' % exc) diff --git a/pysnmp/carrier/twisted/dgram/udp.py b/pysnmp/carrier/twisted/dgram/udp.py index ac0f23f1..bdb93cdd 100644 --- a/pysnmp/carrier/twisted/dgram/udp.py +++ b/pysnmp/carrier/twisted/dgram/udp.py @@ -28,15 +28,15 @@ class UdpTwistedTransport(DgramTwistedTransport): iface = ('', 0) try: self._lport = reactor.listenUDP(iface[1], self, iface[0]) - except Exception: - raise error.CarrierError(sys.exc_info()[1]) + except Exception as exc: + raise error.CarrierError(exc) return self def openServerMode(self, iface): try: self._lport = reactor.listenUDP(iface[1], self, iface[0]) - except Exception: - raise error.CarrierError(sys.exc_info()[1]) + except Exception as exc: + raise error.CarrierError(exc) return self def closeTransport(self): diff --git a/pysnmp/carrier/twisted/dgram/unix.py b/pysnmp/carrier/twisted/dgram/unix.py index a256969c..fe9c459b 100644 --- a/pysnmp/carrier/twisted/dgram/unix.py +++ b/pysnmp/carrier/twisted/dgram/unix.py @@ -24,15 +24,15 @@ class UnixTwistedTransport(DgramTwistedTransport): def openClientMode(self, iface=''): try: self._lport = reactor.connectUNIXDatagram(iface, self) - except Exception: - raise error.CarrierError(sys.exc_info()[1]) + except Exception as exc: + raise error.CarrierError(exc) return self def openServerMode(self, iface): try: self._lport = reactor.listenUNIXDatagram(iface, self) - except Exception: - raise error.CarrierError(sys.exc_info()[1]) + except Exception as exc: + raise error.CarrierError(exc) return self |