From 410be8b4c2d3e268071b101e8e5244f25e2c2b0e Mon Sep 17 00:00:00 2001 From: wmorgan Date: Thu, 3 May 2007 19:55:37 +0000 Subject: [PATCH] catching more weird imap errors git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@388 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- lib/sup/imap.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb index f79befb..6978120 100644 --- a/lib/sup/imap.rb +++ b/lib/sup/imap.rb @@ -209,6 +209,10 @@ private def make_id imap_stuff # use 7 digits for the size. why 7? seems nice. + %w(RFC822.SIZE INTERNALDATE).each do |w| + raise FatalSourceError, "requested data not in IMAP response: #{w}" unless imap_stuff.attr[w] + end + msize, mdate = imap_stuff.attr['RFC822.SIZE'] % 10000000, Time.parse(imap_stuff.attr["INTERNALDATE"]) sprintf("%d%07d", mdate.to_i, msize).to_i end @@ -221,7 +225,7 @@ private got_id = make_id results raise OutOfSyncSourceError, "IMAP message mismatch: requested #{id}, got #{got_id}." unless got_id == id - fields.map { |f| results.attr[f] } + fields.map { |f| results.attr[f] or raise FatalSourceError, "empty response from IMAP server: #{f}" } end ## execute a block, connected if unconnected, re-connected up to 3 -- 2.45.2