refactor: narrow logging filter exception handling
This commit is contained in:
@@ -12,7 +12,7 @@ class RedactTokenFilter(logging.Filter):
|
|||||||
def filter(self, record: logging.LogRecord) -> bool:
|
def filter(self, record: logging.LogRecord) -> bool:
|
||||||
try:
|
try:
|
||||||
message = record.getMessage()
|
message = record.getMessage()
|
||||||
except Exception:
|
except (TypeError, ValueError):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
redacted = TELEGRAM_TOKEN_RE.sub("bot[REDACTED]", message)
|
redacted = TELEGRAM_TOKEN_RE.sub("bot[REDACTED]", message)
|
||||||
|
|||||||
Reference in New Issue
Block a user