Fix swallowed query-parse errors in request handler
The logging call passed the exception as a positional argument with no
%s placeholder in the format string:
LOGGER.error("Error parsing query: ", e)
Python's logging applies msg % args, which raised TypeError (not all
arguments converted during string formatting) inside logging.handleError.
The logging framework swallows that secondary error, so neither the
intended message nor the exception was ever recorded.
Use an f-string so the exception is actually rendered and logged.
This commit is contained in:
1 parent
1b0008af4f
commit
c6c7cf70ec
1 file changed
+1
-1
@@ -319,7 +319,7 @@ class DNSBaseRequestHandler(socketserver.BaseRequestHandler):
|
|||||||
return
|
return
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOGGER.error("Error parsing query: ", e)
|
LOGGER.error(f"Error parsing query: {e}")
|
||||||
return
|
return
|
||||||
|
|
||||||
# If there was no question in the query, refuse
|
# If there was no question in the query, refuse
|
||||||
|
|||||||
Reference in new issue
Block a user