Skip to content

Commit

Permalink
doc: Make sure message is a string before regexing it
Browse files Browse the repository at this point in the history
There are times when the log message is an exception object and that
causes the regex to fail with a TypeError. Here we work around that
by converting the input to a string.

Signed-off-by: Michael Jones <[email protected]>
  • Loading branch information
michaeljones committed Jun 29, 2023
1 parent 6280a62 commit 396ef38
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/_extensions/zephyr/warnings_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def filter(self, record: logging.LogRecord) -> bool:
return True

for expression in self._expressions:
if re.match(expression, record.msg):
# The message isn't always a string so we convert it before regexing as we can only regex strings
if re.match(expression, str(record.msg)):
if self._silent:
return False
else:
Expand Down

0 comments on commit 396ef38

Please sign in to comment.