Mercurial > code > home > repos > mqtt_metrics
changeset 9:789042521535
crash on regexp syntax errors
author | drewp@bigasterisk.com |
---|---|
date | Mon, 12 Aug 2024 13:14:39 -0700 |
parents | 82cec89e6534 |
children | 2a507e679d0d |
files | mqtt_metrics.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mqtt_metrics.py Sun Aug 11 18:28:53 2024 -0700 +++ b/mqtt_metrics.py Mon Aug 12 13:14:39 2024 -0700 @@ -104,7 +104,12 @@ metricEvents: list[dict] = [] matchedPats = [] for converter in converters: - if not (m := re.search(converter.topic_pattern, message['topic'])): + try: + m = re.search(converter.topic_pattern, message['topic']) + except Exception: + log.error('re.search', exc_info=True) + os.abort() + if not m: continue if not matchedPats: try: