diff options
author | Ricardo Signes <rjbs@cpan.org> | 2020-01-26 13:07:36 -0500 |
---|---|---|
committer | Ricardo Signes <rjbs@cpan.org> | 2020-01-26 13:07:36 -0500 |
commit | 6e7320ebc30270b3a73ed6feb9540125d0afcab7 (patch) | |
tree | 6aa15aa5d6a18ee87f8b9d59bed362f821d58d63 | |
parent | 36ced60fd58da74fd4d6afe27edf8ae6ccbd1d28 (diff) |
when LWP ->mirror dies, do not die with it
-rw-r--r-- | lib/CPAN/Mini.pm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/CPAN/Mini.pm b/lib/CPAN/Mini.pm index 4a0e9f5..d9fa89a 100644 --- a/lib/CPAN/Mini.pm +++ b/lib/CPAN/Mini.pm @@ -469,9 +469,14 @@ sub mirror_file { ); $self->log($path, { no_nl => 1 }); - my $res = $self->{__lwp}->mirror($remote_uri, $local_file); + my $res = eval { $self->{__lwp}->mirror($remote_uri, $local_file) }; - if ($res->is_success) { + if (! $res) { + my $error = $@ || "(unknown error)"; + $self->log(" ... resulted in an HTTP client error"); + $self->log_warn("$remote_uri: $error"); + return; + } elsif ($res->is_success) { utime undef, undef, $local_file if $arg->{update_times}; $checksum_might_be_up_to_date = 0; $self->_recent($path); |