Blob Blame History Raw
From 7dceca71caed20a8990cb1b3e722a3475a1d9d3a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
Date: Fri, 22 Jan 2021 13:46:21 +0100
Subject: [PATCH 2/2] Handle only common exceptions

If system exception or program interrupt occurs, immediately stop
parsing. Let BaseException instances, like KeyboardInterrupt, stop the
whole program. Ignore just Pcapy errors when parsing file.
---
 contrib/queryparse/queryparse | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/queryparse/queryparse b/contrib/queryparse/queryparse
index 29eb5d2..b288270 100755
--- a/contrib/queryparse/queryparse
+++ b/contrib/queryparse/queryparse
@@ -73,7 +73,7 @@ def main(argv):
     while True:
         try:
             packet = pcap.next()
-        except: # lgtm [py/catch-base-exception]
+        except Exception:
             break
 
         if packet[0] is None:
@@ -101,7 +101,7 @@ def main(argv):
 
         try:
             msg = dns.message.from_wire(packet)
-        except: # lgtm [py/catch-base-exception]
+        except Exception:
             continue
         if not opts.recurse and not dns.flags.RD:
             continue
-- 
2.26.2