Skip to content

Commit ac13508

Browse files
authored
irclib: Try to give a more helpful error on unknown batch end
1 parent dc6744b commit ac13508

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/irclib.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,16 @@ def doBatch(self, irc, msg):
11911191
msg.tag('batch', batch)
11921192
self.batches[batch_name] = batch
11931193
elif msg.args[0].startswith('-'):
1194-
batch = self.batches.pop(batch_name)
1194+
try:
1195+
batch = self.batches.pop(batch_name)
1196+
except KeyError:
1197+
log.error(
1198+
"Got end of batch, but there is no corresponding "
1199+
"batch start: %r",
1200+
msg,
1201+
)
1202+
log.error("Previous message was: %r", self.history[-2])
1203+
return
11951204
batch.messages.append(msg)
11961205
msg.tag('batch', batch)
11971206
else:

0 commit comments

Comments
 (0)