File: error.py

package info (click to toggle)
python-pysnmp4 4.1.6a-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,016 kB
  • ctags: 1,826
  • sloc: python: 9,809; sh: 60; makefile: 11
file content (22 lines) | stat: -rw-r--r-- 816 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from pyasn1.error import PyAsn1Error
from pysnmp.error import PySnmpError

class ProtocolError(PySnmpError, PyAsn1Error): pass

# SNMP v3 exceptions

class SnmpV3Error(ProtocolError): pass
class StatusInformation(SnmpV3Error):
    def __init__(self, **kwargs):
        SnmpV3Error.__init__(self)
#        print kwargs
        self.__errorIndication = kwargs
    def __str__(self): return str(self.__errorIndication)
    def __getitem__(self, key): return self.__errorIndication[key]
    def has_key(self, key): return self.__errorIndication.has_key(key)
    def get(self, key, defVal=None):
        return self.__errorIndication.get(key, defVal)
class CacheExpiredError(SnmpV3Error): pass
class InternalError(SnmpV3Error): pass
class MessageProcessingError(SnmpV3Error): pass
class RequestTimeout(SnmpV3Error): pass