From 19be96b4a81dd5389c2754a2edf22d7734a62d33 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 13 Oct 2014 22:51:11 +0200 Subject: [PATCH] Better invalid data logging --- qutebrowser/utils/ipc.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/qutebrowser/utils/ipc.py b/qutebrowser/utils/ipc.py index d9a3a3a22..bbf2fe91c 100644 --- a/qutebrowser/utils/ipc.py +++ b/qutebrowser/utils/ipc.py @@ -21,6 +21,7 @@ import json import getpass +import binascii from PyQt5.QtCore import pyqtSlot, QObject from PyQt5.QtNetwork import QLocalSocket, QLocalServer @@ -133,13 +134,14 @@ class IPCServer(QObject): try: decoded = data.decode('utf-8') except UnicodeDecodeError: - log.ipc.error("Ignoring invalid UTF-8 IPC data.") + log.ipc.error("Ignoring invalid IPC data.") + log.ipc.debug("invalid data: {}".format(binascii.hexlify(data))) return try: args = json.loads(decoded) except ValueError: - log.ipc.error("Ignoring invalid json IPC data '{}'.".format( - decoded)) + log.ipc.error("Ignoring invalid IPC data.") + log.ipc.debug("invalid json: {}".format(decoded.strip())) return log.ipc.debug("Processing: {}".format(decoded)) app = objreg.get('app')