object: handle Error responses and handle errDiskFull. (#1331)

This commit is contained in:
Harshavardhana
2016-04-19 02:42:10 -07:00
committed by Anand Babu (AB) Periasamy
parent 6bc17a3aea
commit e0f8fed011
11 changed files with 77 additions and 202 deletions
+8 -1
View File
@@ -48,6 +48,8 @@ func (o objectAPI) MakeBucket(bucket string) *probe.Error {
if e := o.storage.MakeVol(bucket); e != nil {
if e == errVolumeExists {
return probe.NewError(BucketExists{Bucket: bucket})
} else if e == errDiskFull {
return probe.NewError(StorageFull{})
}
return probe.NewError(e)
}
@@ -209,8 +211,10 @@ func (o objectAPI) PutObject(bucket string, object string, size int64, data io.R
} else if e == errIsNotRegular {
return "", probe.NewError(ObjectExistsAsPrefix{
Bucket: bucket,
Prefix: object,
Object: object,
})
} else if e == errDiskFull {
return "", probe.NewError(StorageFull{})
}
return "", probe.NewError(e)
}
@@ -225,6 +229,9 @@ func (o objectAPI) PutObject(bucket string, object string, size int64, data io.R
if size > 0 {
if _, e = io.CopyN(multiWriter, data, size); e != nil {
safeCloseAndRemove(fileWriter)
if e == io.ErrUnexpectedEOF {
return "", probe.NewError(IncompleteBody{})
}
return "", probe.NewError(e)
}
} else {