diff options
author | Eric Wong <e@80x24.org> | 2023-11-09 10:09:39 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-11-09 21:53:50 +0000 |
commit | b7c01eafca786e1a36b75cb8ec682a6d008a0a36 (patch) | |
tree | a7b71346aca332660653d175d78d930615d50c38 /lib/PublicInbox | |
parent | bc20665c3e76fb8dc2f304ee88bad51c40c8b40b (diff) | |
download | public-inbox-b7c01eafca786e1a36b75cb8ec682a6d008a0a36.tar.gz |
All network connections may fail, so try to emit a helpful error message instead of attempting to dispatch methods off `undef'.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/LeiLsMailSource.pm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/PublicInbox/LeiLsMailSource.pm b/lib/PublicInbox/LeiLsMailSource.pm index 50799270..4b427b26 100644 --- a/lib/PublicInbox/LeiLsMailSource.pm +++ b/lib/PublicInbox/LeiLsMailSource.pm @@ -19,7 +19,8 @@ sub input_path_url { # overrides LeiInput version if ($url =~ m!\Aimaps?://!i) { my $uri = PublicInbox::URIimap->new($url); my $sec = $lei->{net}->can('uri_section')->($uri); - my $mic = $lei->{net}->mic_get($uri); + my $mic = $lei->{net}->mic_get($uri) or + return $lei->err("E: $uri"); 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] } @@ -39,7 +40,8 @@ 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); + my $nn = $lei->{net}->nn_get($uri) or + return $lei->err("E: $uri"); my $l = $nn->newsgroups($uri->group); # name => description my $sec = $lei->{net}->can('uri_section')->($uri); if ($json) { |