Add errstr reporting on add_key_filename failure

This commit is contained in:
Isaac Connor 2019-08-27 13:11:38 -04:00
parent 561fcfac7d
commit b0b27a24aa
1 changed files with 3 additions and 4 deletions

View File

@ -596,8 +596,8 @@ sub CopyTo {
my $event_path = $self->RelativePath(); my $event_path = $self->RelativePath();
if ( 0 ) { # Not neccessary if ( 0 ) { # Not neccessary
Debug("Making directory $event_path/"); Debug("Making directory $event_path/");
if ( ! $bucket->add_key($event_path.'/', '') ) { if ( !$bucket->add_key($event_path.'/', '') ) {
Warning( "Unable to add key for $event_path/"); Warning("Unable to add key for $event_path/");
} }
} }
@ -625,11 +625,10 @@ sub CopyTo {
} else { } else {
my $filename = $event_path.'/'.File::Basename::basename($file); my $filename = $event_path.'/'.File::Basename::basename($file);
if ( ! $bucket->add_key_filename($filename, $file) ) { if ( ! $bucket->add_key_filename($filename, $file) ) {
die "Unable to add key for $filename"; die "Unable to add key for $filename " . $s3->err . ': '. $s3->errstr;
} }
} }
my $duration = tv_interval($starttime); my $duration = tv_interval($starttime);
Debug('PUT to S3 ' . Number::Bytes::Human::format_bytes($size) . " in $duration seconds = " . Number::Bytes::Human::format_bytes($duration?$size/$duration:$size) . '/sec'); Debug('PUT to S3 ' . Number::Bytes::Human::format_bytes($size) . " in $duration seconds = " . Number::Bytes::Human::format_bytes($duration?$size/$duration:$size) . '/sec');
} # end foreach file. } # end foreach file.