Skip to content

Commit ab858d7

Browse files
committed
fix: exception handling for failing regex compilation
1 parent 52cdb4b commit ab858d7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

technology_specific_extractors/kafka/kfk_entry.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,13 @@ def match_incoming_to_outgoing_endpoints(microservices: dict, incoming_endpoints
269269

270270
# this next block is because i don't know if one can put regex as topic when sending as well. Since it's a set, this doesn't hurt
271271
for o in outgoing_endpoints:
272-
regex = re.compile(o[0])
273-
for i in incoming_endpoints:
274-
if re.search(regex, i[0]):
275-
information_flows_set.add((o[1], i[1], i[0], o[2], i[2], o[3]))
272+
try:
273+
regex = re.compile(o[0])
274+
for i in incoming_endpoints:
275+
if re.search(regex, i[0]):
276+
information_flows_set.add((o[1], i[1], i[0], o[2], i[2], o[3]))
277+
except (TypeError, re.error) as e:
278+
logger.info(f"Error in regex compiling {o[0]}: {e}")
276279

277280
# turn it into a dictionary
278281
for i in information_flows_set:

0 commit comments

Comments
 (0)