]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
net_reader: improve IMAP error reporting
authorEric Wong <e@80x24.org>
Wed, 14 Aug 2024 00:16:45 +0000 (00:16 +0000)
committerEric Wong <e@80x24.org>
Thu, 15 Aug 2024 08:29:06 +0000 (08:29 +0000)
IMAPClient->LastError provides information that isn't an errno
(`$!'), so use it to tell us about anything the server reports
back.

lib/PublicInbox/NetReader.pm

index ec18818bbbd043040f4fa05e1d83049a0c0dedd9..7e861f5f1f8893ae369b8f75206ce76ad9395c15 100644 (file)
@@ -570,7 +570,8 @@ sub each_old_flags ($$$$) {
                my $r = $mic->fetch_hash("$n:$end", 'FLAGS');
                if (!$r) {
                        return if $!{EINTR} && $self->{quit};
-                       return "E: $uri UID FETCH $n:$end error: $!";
+                       return "E: $uri UID FETCH $n:$end error: " .
+                               $mic->LastError." \$!=$!"
                }
                while (my ($uid, $per_uid) = each %$r) {
                        my $kw = flags2kw($self, $uri, $uid, $per_uid->{FLAGS})
@@ -699,7 +700,8 @@ EOF
                        $uids = [ $single_uid ];
                } elsif (!($uids = $mic->search("UID $l_uid:*"))) {
                        return if $!{EINTR} && $self->{quit};
-                       return "E: $uri UID SEARCH $l_uid:* error: $!";
+                       return "E: $uri UID SEARCH $l_uid:* error: ".
+                               $mic->LastError." \$!=$!"
                }
                return if scalar(@$uids) == 0;