Skip to content

Commit 8fcca45

Browse files
committed
codacity: fix try-catch_Exception-pass violations
1 parent 19884ac commit 8fcca45

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

scapy/contrib/automotive/j1939/j1939_dm_scanner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ def j1939_scan_dm(
422422
"retrying in 1 s",
423423
attempt + 1,
424424
reconnect_retries,
425+
exc_info=True,
425426
)
426427
if stop_event is not None:
427428
stop_event.wait(1)

scapy/contrib/automotive/j1939/j1939_scanner.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ def _pre_probe_flush(sock):
288288
try:
289289
sock.select([sock], 0)
290290
except Exception:
291-
pass
291+
log_j1939.debug("Exception during _pre_probe_flush select",
292+
exc_info=True)
292293

293294

294295
# --- Socketcan filter helpers

scapy/contrib/automotive/scanner/executor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ def reset_target(self):
167167
try:
168168
result.close()
169169
except Exception:
170-
pass
170+
log_automotive.debug("Exception while closing leaked socket",
171+
exc_info=True)
171172
elif self.software_reset_handler:
172173
if self.socket and self.socket.closed:
173174
self.reconnect()

scapy/contrib/cansocket_python_can.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,8 @@ def close(self):
491491
try:
492492
SocketsPool.multiplex_rx_packets()
493493
except Exception:
494-
pass
494+
log_runtime.debug("Exception during SocketsPool multiplex in close",
495+
exc_info=True)
495496
super(PythonCANSocket, self).close()
496497
self.can_iface.shutdown()
497498

scapy/contrib/isotp/isotp_soft_socket.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,8 @@ def __init__(self,
591591
try:
592592
self.can_socket.select([self.can_socket], 0)
593593
except Exception:
594-
pass
594+
log_isotp.debug("Exception during ISOTP socket drain select",
595+
exc_info=True)
595596

596597
# Schedule initial callbacks with timeout=0 so they fire on
597598
# the very next TimeoutScheduler._poll() cycle, minimising
@@ -754,7 +755,8 @@ def close(self):
754755
try:
755756
self.can_socket.select([self.can_socket], 0)
756757
except Exception:
757-
pass
758+
log_isotp.debug("Exception during ISOTP socket drain select",
759+
exc_info=True)
758760

759761
try:
760762
self.rx_queue.close()

0 commit comments

Comments
 (0)