File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ def onReceive(packet, interface) -> None:
7474 args
7575 and args .sendtext
7676 and packet ["to" ] == interface .myInfo .my_node_num
77- and d [ "portnum" ] == portnums_pb2 .PortNum .TEXT_MESSAGE_APP
77+ and d . get ( "portnum" , portnums_pb2 . PortNum . UNKNOWN_APP ) == portnums_pb2 .PortNum .TEXT_MESSAGE_APP
7878 ):
7979 interface .close () # after running command then exit
8080
@@ -90,7 +90,7 @@ def onReceive(packet, interface) -> None:
9090 interface .sendText (reply )
9191
9292 except Exception as ex :
93- print (f"Warning: There is no field { ex } in the packet ." )
93+ print (f"Warning: Error processing received packet: { ex } ." )
9494
9595
9696def onConnection (interface , topic = pub .AUTO_TOPIC ) -> None : # pylint: disable=W0613
Original file line number Diff line number Diff line change @@ -1608,7 +1608,7 @@ def test_main_onReceive_empty(caplog, capsys):
16081608 assert re .search (r"in onReceive" , caplog .text , re .MULTILINE )
16091609 out , err = capsys .readouterr ()
16101610 assert re .search (
1611- r"Warning: There is no field 'to' in the packet ." , out , re .MULTILINE
1611+ r"Warning: Error processing received packet: 'to'." , out , re .MULTILINE
16121612 )
16131613 assert err == ""
16141614
You can’t perform that action at this time.
0 commit comments