pipe: Print a helpful message for s3 upon invalid arguments.
Fixes #1373
This commit is contained in:
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user