mirror/cp: Skip NoSuckKey, NoSuchBucket errors properly in cp/mirror.

Fixes #1693
This commit is contained in:
Harshavardhana
2016-04-27 20:37:42 -07:00
parent 2fec2b4107
commit 319b3d8434
2 changed files with 16 additions and 12 deletions
+13
View File
@@ -148,6 +148,19 @@ func (c *s3Client) Get() (io.Reader, *probe.Error) {
if errResponse.Code == "AccessDenied" {
return nil, probe.NewError(PathInsufficientPermission{Path: c.targetURL.String()})
}
if errResponse.Code == "NoSuchBucket" {
return nil, probe.NewError(BucketDoesNotExist{
Bucket: bucket,
})
}
if errResponse.Code == "InvalidBucketName" {
return nil, probe.NewError(BucketInvalid{
Bucket: bucket,
})
}
if errResponse.Code == "NoSuchKey" || errResponse.Code == "InvalidArgument" {
return nil, probe.NewError(ObjectMissing{})
}
return nil, probe.NewError(e)
}
return reader, nil
+3 -12
View File
@@ -348,19 +348,10 @@ func doCopySession(session *sessionV7) {
// For all non critical errors we can continue for the
// remaining files.
switch cpURLs.Error.ToGoError().(type) {
// Handle this specifically for filesystem related
// errors.
case BrokenSymlink:
// Handle this specifically for filesystem related errors.
case BrokenSymlink, TooManyLevelsSymlink, PathNotFound, PathInsufficientPermission:
continue
case TooManyLevelsSymlink:
continue
case PathNotFound:
continue
case PathInsufficientPermission:
continue
case ObjectAlreadyExists:
continue
case BucketDoesNotExist:
case BucketNameEmpty, ObjectMissing, ObjectAlreadyExists, BucketDoesNotExist, BucketInvalid:
continue
}
// For critical errors we should exit. Session