Fix PySnmpError implementation
This is a follow up fix to make PySnmpError properly overriding base Exception call signaturepull/186/head
parent
853ba0bbf5
commit
3b514f9aec
|
@ -9,6 +9,15 @@ import sys
|
|||
|
||||
|
||||
class PySnmpError(Exception):
|
||||
def __init__(self, message):
|
||||
def __init__(self, *args):
|
||||
msg = args and str(args[0]) or ''
|
||||
|
||||
self.cause = sys.exc_info()
|
||||
Exception.__init__(self, '%s, caused by %s: %s' % (message, self.cause[0], self.cause[1]))
|
||||
|
||||
if self.cause[0]:
|
||||
msg += 'caused by %s: %s' % (self.cause[0], self.cause[1])
|
||||
|
||||
if msg:
|
||||
args = (msg,) + args[1:]
|
||||
|
||||
Exception.__init__(self, *args)
|
||||
|
|
Loading…
Reference in New Issue