File tree 1 file changed +10
-4
lines changed
src/navigate/model/devices/APIs/asi
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,11 @@ def __init__(self, code: str):
84
84
self .code = code
85
85
86
86
#: str: Error message
87
- self .message = self .error_codes [code ]
87
+ try :
88
+ self .message = self .error_codes [code ]
89
+ except KeyError :
90
+ # if the exception is not a standard ASI Error Code:
91
+ self .message = code
88
92
89
93
# Gets the proper message based on error code received.
90
94
super ().__init__ (self .message )
@@ -371,10 +375,12 @@ def read_response(self) -> str:
371
375
self .safe_to_write .set ()
372
376
response = response .decode (encoding = "ascii" )
373
377
# Remove leading and trailing empty spaces
374
- self .report_to_console (f"Received Response: { response .strip ()} " )
378
+ response = response .strip ()
379
+ self .report_to_console (f"Received Response: { response } " )
375
380
if response .startswith (":N" ):
376
- logger .error (f"Incorrect response received: { response } " )
377
- raise MS2000Exception (response )
381
+ if not response .endswith ("-21" ): # we can ignore HALT command exceptions
382
+ logger .error (f"Incorrect response received: { response } " )
383
+ raise MS2000Exception (response )
378
384
379
385
return response # in case we want to read the response
380
386
You can’t perform that action at this time.
0 commit comments