Skip to content
Snippets Groups Projects
Commit b6681a9d authored by Eric S. Raymond's avatar Eric S. Raymond
Browse files

Improve error diagnostics for malformed JSON.

parent 9ae1fc28
No related branches found
No related tags found
No related merge requests found
......@@ -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]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment