/usr/share/pyshared/pymodbus/exceptions.py is in python-pymodbus 1.2.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | '''
Pymodbus Exceptions
--------------------
Custom exceptions to be used in the Modbus code.
'''
class ModbusException(Exception):
''' Base modbus exception '''
def __init__(self, string):
''' Initialize the exception
:param string: The message to append to the error
'''
self.string = string
def __str__(self):
return 'Modbus Error: %s' % self.string
class ModbusIOException(ModbusException):
''' Error resulting from data i/o '''
def __init__(self, string=""):
''' Initialize the exception
:param string: The message to append to the error
'''
message = "[Input/Output] %s" % string
ModbusException.__init__(self, message)
class ParameterException(ModbusException):
''' Error resulting from invalid paramater '''
def __init__(self, string=""):
''' Initialize the exception
:param string: The message to append to the error
'''
message = "[Invalid Paramter] %s" % string
ModbusException.__init__(self, message)
class NotImplementedException(ModbusException):
''' Error resulting from not implemented function '''
def __init__(self, string=""):
''' Initialize the exception
:param string: The message to append to the error
'''
message = "[Not Implemented] %s" % string
ModbusException.__init__(self, message)
class ConnectionException(ModbusException):
''' Error resulting from a bad connection '''
def __init__(self, string=""):
''' Initialize the exception
:param string: The message to append to the error
'''
message = "[Connection] %s" % string
ModbusException.__init__(self, message)
#---------------------------------------------------------------------------#
# Exported symbols
#---------------------------------------------------------------------------#
__all__ = [
"ModbusException", "ModbusIOException",
"ParameterException", "NotImplementedException",
"ConnectionException",
]
|