[#129] client: Do not override error status WriteObject() #130

Merged
fyrchik merged 1 commit from fyrchik/frostfs-sdk-go:client-fix-transformer into master 2023-07-28 07:34:56 +00:00

View file

@ -3,6 +3,7 @@ package client
import ( import (
"context" "context"
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
@ -82,6 +83,9 @@ func (it *internalTarget) putAsStream(ctx context.Context, o *object.Object) err
wrt.WritePayloadChunk(ctx, o.Payload()) wrt.WritePayloadChunk(ctx, o.Payload())
} }
it.res, err = wrt.Close(ctx) it.res, err = wrt.Close(ctx)
if err == nil && !it.client.prm.resolveFrostFSErrors && !apistatus.IsSuccessful(it.res.st) {
err = apistatus.ErrFromStatus(it.res.st)
}
return err return err
} }
@ -106,6 +110,10 @@ func (it *internalTarget) tryPutSingle(ctx context.Context, o *object.Object) (b
statusRes: res.statusRes, statusRes: res.statusRes,
obj: id, obj: id,
} }
if !it.client.prm.resolveFrostFSErrors && !apistatus.IsSuccessful(it.res.st) {
return true, apistatus.ErrFromStatus(it.res.st)
}
return true, nil
} }
return true, err return true, err
} }