]> git.cworth.org Git - sup/commitdiff
fixed imap each throwing uncaught sourceerror
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 14 Feb 2007 01:42:17 +0000 (01:42 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 14 Feb 2007 01:42:17 +0000 (01:42 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@328 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/poll.rb

index 03e0c9fc367cfc4c7c31974c27a36b10767c17e6..6a17409470abdff035b1be6cfcb124c004dda76a 100644 (file)
@@ -83,15 +83,15 @@ class PollManager
   def add_new_messages_from source
     return if source.done? || source.broken?
 
-    source.each do |offset, labels|
-      if source.broken?
-        Redwood::log "error loading messages from #{source}: #{source.broken_msg}"
-        return
-      end
+    begin
+      source.each do |offset, labels|
+        if source.broken?
+          Redwood::log "error loading messages from #{source}: #{source.broken_msg}"
+          return
+        end
       
-      labels.each { |l| LabelManager << l }
+        labels.each { |l| LabelManager << l }
 
-      begin
         m = Message.new :source => source, :source_info => offset, :labels => labels
         if m.source_marked_read?
           m.remove_label :unread
@@ -107,9 +107,9 @@ class PollManager
           Index.add_message m
           UpdateManager.relay self, :add, m
         end
-      rescue MessageFormatError, SourceError => e
-        Redwood::log "ignoring erroneous message at #{source}##{offset}: #{e.message}"
       end
+    rescue MessageFormatError, SourceError => e
+      Redwood::log "found problem with #{source}: #{e.message}"
     end
   end
 end