mirror of https://github.com/minio/minio.git
fix: avoid printing certain errors under few locations (#16631)
This commit is contained in:
parent
a7188bc9d0
commit
6ea150fd68
|
@ -86,7 +86,11 @@ func (api objectAPIHandlers) PutBucketPolicyHandler(w http.ResponseWriter, r *ht
|
|||
|
||||
bucketPolicy, err := policy.ParseConfig(bytes.NewReader(bucketPolicyBytes), bucket)
|
||||
if err != nil {
|
||||
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
||||
writeErrorResponse(ctx, w, APIError{
|
||||
Code: "ErrMalformedXML",
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
Description: err.Error(),
|
||||
}, r.URL)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,11 @@ func (a kmsAPIHandlers) KMSMetricsHandler(w http.ResponseWriter, r *http.Request
|
|||
return
|
||||
}
|
||||
|
||||
if _, ok := GlobalKMS.(kms.KeyManager); !ok {
|
||||
writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrNotImplemented), r.URL)
|
||||
return
|
||||
}
|
||||
|
||||
metrics, err := GlobalKMS.Metrics(ctx)
|
||||
if err != nil {
|
||||
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
|
||||
|
|
|
@ -316,11 +316,11 @@ func (z *erasureServerPools) listMerged(ctx context.Context, o listPathOptions,
|
|||
}
|
||||
|
||||
for _, err := range errs {
|
||||
if err == nil || contextCanceled(ctx) {
|
||||
allAtEOF = false
|
||||
if errors.Is(err, io.EOF) {
|
||||
continue
|
||||
}
|
||||
if err.Error() == io.EOF.Error() {
|
||||
if err == nil || contextCanceled(ctx) || errors.Is(err, context.Canceled) {
|
||||
allAtEOF = false
|
||||
continue
|
||||
}
|
||||
logger.LogIf(ctx, err)
|
||||
|
|
|
@ -376,7 +376,7 @@ func (r *metacacheReader) filter(o listPathOptions) (entries metaCacheEntriesSor
|
|||
entries.o = append(entries.o, entry)
|
||||
return entries.len() < o.Limit
|
||||
})
|
||||
if (err != nil && err.Error() == io.EOF.Error()) || pastPrefix || r.nextEOF() {
|
||||
if (err != nil && errors.Is(err, io.EOF)) || pastPrefix || r.nextEOF() {
|
||||
return entries, io.EOF
|
||||
}
|
||||
return entries, err
|
||||
|
@ -534,7 +534,7 @@ func (er *erasureObjects) streamMetadataParts(ctx context.Context, o listPathOpt
|
|||
// We stopped within the listing, we are done for now...
|
||||
return entries, nil
|
||||
}
|
||||
if err != nil && err.Error() != io.EOF.Error() {
|
||||
if err != nil && !errors.Is(err, io.EOF) {
|
||||
switch toObjectErr(err, minioMetaBucket, o.objectPath(partN)).(type) {
|
||||
case ObjectNotFound:
|
||||
retries++
|
||||
|
@ -940,15 +940,6 @@ func listPathRaw(ctx context.Context, opts listPathRawOptions) (err error) {
|
|||
}
|
||||
}
|
||||
w.CloseWithError(werr)
|
||||
|
||||
if werr != io.EOF && werr != nil &&
|
||||
werr.Error() != errFileNotFound.Error() &&
|
||||
werr.Error() != errVolumeNotFound.Error() &&
|
||||
werr.Error() != errDiskNotFound.Error() &&
|
||||
werr.Error() != errUnformattedDisk.Error() &&
|
||||
!errors.Is(werr, context.Canceled) {
|
||||
logger.LogIf(ctx, werr)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
|
|
|
@ -91,12 +91,15 @@ func (kms secretKey) Stat(context.Context) (Status, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (secretKey) Metrics(ctx context.Context) (kes.Metric, error) {
|
||||
return kes.Metric{}, errors.New("kms: metrics are not supported")
|
||||
func (secretKey) Metrics(context.Context) (kes.Metric, error) {
|
||||
return kes.Metric{}, errors.New("kms: metrics not supported")
|
||||
}
|
||||
|
||||
func (secretKey) CreateKey(context.Context, string) error {
|
||||
return errors.New("kms: creating keys is not supported")
|
||||
func (kms secretKey) CreateKey(_ context.Context, keyID string) error {
|
||||
if keyID == kms.keyID {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("kms: creating custom key %q is not supported", keyID)
|
||||
}
|
||||
|
||||
func (kms secretKey) GenerateKey(_ context.Context, keyID string, context Context) (DEK, error) {
|
||||
|
|
Loading…
Reference in New Issue