From b6681a9d8b02eeed0380c1ea2867d6346950b4d4 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 4 Oct 2012 16:10:20 -0400 Subject: [PATCH] Improve error diagnostics for malformed JSON. --- irkerd | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/irkerd b/irkerd index 6c8e56c..a9c6eed 100755 --- a/irkerd +++ b/irkerd @@ -399,9 +399,10 @@ class Irker: else: channels = request['to'] message = request['privmsg'] - if not isinstance(channels, (list, unicode)) \ - and not isinstance(message, unicode): - self.logerr("malformed request - unexpected types: %r" % request) + if type(channels) not in (type([]), type(""), type(u"")): + self.logerr("malformed request - unexpected channel type: %r" % channels) + if type(message) not in (type(""), type(u"")): + self.logerr("malformed request - unexpected message type: %r" % message) else: if isinstance(channels, unicode): channels = [channels] -- 2.26.2