@@ -81,30 +81,27 @@ def _wrapper(*args, **kwargs):
81
81
_Base = object
82
82
83
83
84
- class ExtendedRequestSupport (_Base ): # pylint: disable=( too-many-public-methods
84
+ class ExtendedRequestSupport (_Base ): # pylint: disable=too-many-public-methods
85
85
"""Extended request support."""
86
86
87
87
@staticmethod
88
88
def _process_exception (resp , ** kwargs ):
89
89
"""Set internal process exception."""
90
90
if "slave" not in kwargs :
91
- err = {"message" : "Broadcast message, ignoring errors!!!" }
92
- else :
93
- if isinstance (resp , ExceptionResponse ): # pylint: disable=else-if-used
94
- err = {
95
- "original_function_code" : f"{ resp .original_code } ({ hex (resp .original_code )} )" ,
96
- "error_function_code" : f"{ resp .function_code } ({ hex (resp .function_code )} )" ,
97
- "exception code" : resp .exception_code ,
98
- "message" : ExceptionResponse .decode (resp .exception_code ),
99
- }
100
- elif isinstance (resp , ModbusIOException ):
101
- err = {
102
- "original_function_code" : f"{ resp .fcode } ({ hex (resp .fcode )} )" ,
103
- "error" : resp .message ,
104
- }
105
- else :
106
- err = {"error" : str (resp )}
107
- return err
91
+ return {"message" : "Broadcast message, ignoring errors!!!" }
92
+ if isinstance (resp , ExceptionResponse ): # pylint: disable=else-if-used
93
+ return {
94
+ "original_function_code" : f"{ resp .original_code } ({ hex (resp .original_code )} )" ,
95
+ "error_function_code" : f"{ resp .function_code } ({ hex (resp .function_code )} )" ,
96
+ "exception code" : resp .exception_code ,
97
+ "message" : ExceptionResponse .decode (resp .exception_code ),
98
+ }
99
+ if isinstance (resp , ModbusIOException ):
100
+ return {
101
+ "original_function_code" : f"{ resp .fcode } ({ hex (resp .fcode )} )" ,
102
+ "error" : resp .message ,
103
+ }
104
+ return {"error" : str (resp )}
108
105
109
106
def read_coils (self , address , count = 1 , slave = 0 , ** kwargs ):
110
107
"""Read `count` coils from a given slave starting at `address`.
0 commit comments