Better error message when trying to monitor a non minio s3 provider (#1854)

This commit is contained in:
Anis Elleuch
2016-10-13 09:16:46 -07:00
committed by Harshavardhana
parent d9b3f276b8
commit b737b2e7fc
+6 -1
View File
@@ -397,7 +397,12 @@ func (c *s3Client) Watch(params watchParams) (*watchObject, *probe.Error) {
go func() {
for notificationInfo := range eventsCh {
if notificationInfo.Err != nil {
errorChan <- probe.NewError(notificationInfo.Err)
if nErr, ok := notificationInfo.Err.(minio.ErrorResponse); ok && nErr.Code == "APINotSupported" {
errorChan <- probe.NewError(errors.New("The specified S3 target is not supported. " +
"Only Minio based storages provide monitoring feature."))
} else {
errorChan <- probe.NewError(notificationInfo.Err)
}
continue
}