pipe: Print a helpful message for s3 upon invalid arguments.

Fixes #1373
This commit is contained in:
Harshavardhana
2015-11-17 14:49:18 -08:00
parent eada588802
commit 9caa205f40
2 changed files with 12 additions and 2 deletions
+9 -2
View File
@@ -125,16 +125,23 @@ func (e BrokenSymlink) Error() string {
return "Requested file ‘" + e.Path + "’ has broken symlink"
}
// TooManyLevelsSymlink (ELOOP) - file has too many levels of symlinks
// TooManyLevelsSymlink (ELOOP) - file has too many levels of symlinks.
type TooManyLevelsSymlink GenericFileError
func (e TooManyLevelsSymlink) Error() string {
return "Requested file ‘" + e.Path + "’ has too many levels of symlinks"
}
// EmptyPath (EINVAL) - invalid argument
// EmptyPath (EINVAL) - invalid argument.
type EmptyPath struct{}
func (e EmptyPath) Error() string {
return "Invalid path, path cannot be empty"
}
// ObjectMissing (EINVAL) - object key missing.
type ObjectMissing struct{}
func (e ObjectMissing) Error() string {
return "Object key is missing, object key cannot be empty"
}
+3
View File
@@ -157,6 +157,9 @@ func (c *s3Client) Put(size int64, data io.Reader) *probe.Error {
if errResponse.Code == "MethodNotAllowed" {
return probe.NewError(client.ObjectAlreadyExists{Object: object})
}
if errResponse.Code == "InvalidArgument" {
return probe.NewError(client.ObjectMissing{})
}
}
return probe.NewError(err)
}