sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit a5aa56f037e77b5b4bd82434a3bc2e25446c758a
parent bddd7f096cd836fa18221116dcc99aa3257c91ab
Author: Dan Callaghan <djc@djc.id.au>
Date:   Sun,  7 Apr 2024 11:20:03 +1000

fix rescue path for OutOfSyncSourceError

This rescue block was supposed to let sup recover from a failure to load
a message, and just show an error in place of the body. But in the case
of OutOfSyncSourceError (which might be the only error we hit here?) the
rescue path itself triggered another OutOfSyncSourceError because of its
log messages.

    --- Redwood::OutOfSyncSourceError from thread: load messages for thread-view-mode
    Redwood::OutOfSyncSourceError
    /home/dan/sup/lib/sup/message.rb:246:in `location'
    /home/dan/sup/lib/sup/message.rb:763:in `warn_with_location'
    /home/dan/sup/lib/sup/message.rb:273:in `rescue in load_from_source!'
    /home/dan/sup/lib/sup/message.rb:260:in `load_from_source!'
    /home/dan/sup/lib/sup/modes/thread_index_mode.rb:117:in `block (3 levels) in select'
    /home/dan/sup/lib/sup/thread.rb:70:in `block in each'
    /home/dan/sup/lib/sup/thread.rb:176:in `each_with_stuff'
    /home/dan/sup/lib/sup/thread.rb:69:in `each'
    /home/dan/sup/lib/sup/modes/thread_index_mode.rb:114:in `each_with_index'
    /home/dan/sup/lib/sup/modes/thread_index_mode.rb:114:in `block (2 levels) in select'
    /home/dan/sup/lib/sup/buffer.rb:700:in `say'
    (eval at /home/dan/sup/lib/sup/util.rb:580):1:in `say'
    /home/dan/sup/lib/sup/modes/thread_index_mode.rb:113:in `block in select'
    /home/dan/sup/lib/sup.rb:84:in `block in reporting_thread'

Fix the logging to avoid triggering more OutOfSyncSourceErrors.

Diffstat:
M lib/sup/message.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
@@ -271,7 +271,7 @@ class Message
         message_to_chunks rmsg
       rescue SourceError, SocketError, RMail::EncodingUnsupportedError => e
         warn_with_location "problem reading message #{id}"
-        debug "could not load message: #{location.inspect}, exception: #{e.inspect}"
+        debug "could not load message, exception: #{e.inspect}"
 
         [Chunk::Text.new(error_message.split("\n"))]
 
@@ -760,7 +760,7 @@ private
 
   def warn_with_location msg
     warn msg
-    warn "Message is in #{location.source.uri} at #{location.info}"
+    warn "Message is in #{@locations}"
   end
 end