webhooks: Log json encoding errors
Signed-off-by: Justin Schuh <code@justinschuh.com>
This commit is contained in:
parent
40b4b34998
commit
d68a6c28ba
|
@ -268,8 +268,14 @@ class ClientConnection:
|
||||||
self.send(result)
|
self.send(result)
|
||||||
|
|
||||||
def send(self, data):
|
def send(self, data):
|
||||||
|
try:
|
||||||
jmsg = json.dumps(data, separators=(',', ':'))
|
jmsg = json.dumps(data, separators=(',', ':'))
|
||||||
self.send_buffer += jmsg.encode() + b"\x03"
|
self.send_buffer += jmsg.encode() + b"\x03"
|
||||||
|
except (TypeError, ValueError) as e:
|
||||||
|
msg = ("json encoding error: %s" % (str(e),))
|
||||||
|
logging.exception(msg)
|
||||||
|
self.printer.invoke_shutdown(msg)
|
||||||
|
return
|
||||||
if not self.is_blocking:
|
if not self.is_blocking:
|
||||||
self._do_send()
|
self._do_send()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue