summaryrefslogtreecommitdiff
path: root/pysnmp/error.py
blob: fcfdf226c7caf5c1439c78eec317a3a36bd6c929 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
# Top-level exception class
class PySnmpError(Exception):
    def __init__(self, why=None):
        Exception.__init__(self)
        self.why = why
    def __str__(self): return str(self.why)
    def __repr__(self): return self.__class__.__name__ + '(' + repr(self.why) + ')'
    def __nonzero__(self):
        if self.why: return 1
        else: return 0

class PySnmpVersionError(PySnmpError): pass