From: Eric Wong Date: Wed, 14 Aug 2024 00:16:45 +0000 (+0000) Subject: net_reader: improve IMAP error reporting X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec5aaf753a76a735b6d3aac22adfe5b3a677ebcf;p=thirdparty%2Fpublic-inbox.git net_reader: improve IMAP error reporting IMAPClient->LastError provides information that isn't an errno (`$!'), so use it to tell us about anything the server reports back. --- diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm index ec18818bb..7e861f5f1 100644 --- a/lib/PublicInbox/NetReader.pm +++ b/lib/PublicInbox/NetReader.pm @@ -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;