From: Eric Wong Date: Thu, 27 Mar 2025 23:20:47 +0000 (+0000) Subject: lei ls-mail-source: propagate errors to caller X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c0d4f078b3e699946c35daf61e3ceb45c44649b;p=thirdparty%2Fpublic-inbox.git lei ls-mail-source: propagate errors to caller LeiInput already handles exceptions via `die', so just die rather than using lei->err() to report to stderr without affecting the exit code. I noticed this problem while making some changes to our NNTP implementation. --- diff --git a/lib/PublicInbox/LeiLsMailSource.pm b/lib/PublicInbox/LeiLsMailSource.pm index 65e3b0ff6..1d75dd5a1 100644 --- a/lib/PublicInbox/LeiLsMailSource.pm +++ b/lib/PublicInbox/LeiLsMailSource.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # command for listing NNTP groups and IMAP folders, @@ -21,7 +21,7 @@ sub input_path_url { # overrides LeiInput version my $uri = PublicInbox::URIimap->new($url); my $sec = $lei->{net}->can('uri_section')->($uri); my $mic = $lei->{net}->mic_get($uri) or - return $lei->err("E: $uri"); + die "E: <$uri> can't get IMAP client"; my $l = $mic->folders_hash($uri->path); # server-side filter @$l = map { $_->[2] } # undo Schwartzian transform below: sort { $a->[0] cmp $b->[0] || $a->[1] <=> $b->[1] } @@ -42,9 +42,9 @@ sub input_path_url { # overrides LeiInput version } elsif ($url =~ m!\A(?:nntps?|s?news)://!i) { my $uri = PublicInbox::URInntps->new($url); my $nn = $lei->{net}->nn_get($uri) or - return $lei->err("E: $uri"); + die "E: <$uri> can't get NNTP client"; # $l = name => description - my $l = $nn->newsgroups($uri->group) // return $lei->err(<newsgroups($uri->group) // die <message))} E: login may be required, try adding `-c nntp.debug' to your command EOM