API: add writePartTooSmallErrorResponse to extend standard error responses. (#2005)

This function is added to extend the standard error responses.
Which is needed in some cases for example CompleteMultipartUpload
should respond with ErrPartTooSmall error when parts uploaded are
lesser than 5MB (i.e minimum allowed size per part).

Fixes #1536
This commit is contained in:
Harshavardhana
2016-06-28 14:51:49 -07:00
committed by GitHub
parent 6dcfa7b046
commit 748dc80047
8 changed files with 188 additions and 7 deletions

View File

@@ -251,8 +251,12 @@ func (e InvalidPartOrder) Error() string {
}
// PartTooSmall - error if part size is less than 5MB.
type PartTooSmall struct{}
type PartTooSmall struct {
PartSize int64
PartNumber int
PartETag string
}
func (e PartTooSmall) Error() string {
return "Part size should be atleast 5MB"
return fmt.Sprintf("Part size for %d should be atleast 5MB", e.PartNumber)
}