From ff02c86dbfefcfc271a13a847e354e4bcfab8d79 Mon Sep 17 00:00:00 2001 From: Nikita Zinkevich Date: Tue, 24 Sep 2024 18:26:44 +0300 Subject: [PATCH] [#488] middleware/policy: Add FrostFs-to-S3 error transformation Signed-off-by: Nikita Zinkevich --- api/middleware/policy.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/middleware/policy.go b/api/middleware/policy.go index 1bbb8ca..2c07c3f 100644 --- a/api/middleware/policy.go +++ b/api/middleware/policy.go @@ -11,7 +11,6 @@ import ( "strings" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data" - frostfsErrors "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/frostfs/errors" apierr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/errors" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/logs" "git.frostfs.info/TrueCloudLab/policy-engine/pkg/chain" @@ -85,7 +84,7 @@ func PolicyCheck(cfg PolicyConfig) Func { ctx := r.Context() if err := policyCheck(r, cfg); err != nil { reqLogOrDefault(ctx, cfg.Log).Error(logs.PolicyValidationFailed, zap.Error(err)) - err = frostfsErrors.UnwrapErr(err) + err = apierr.TransformToS3Error(err) if _, wrErr := WriteErrorResponse(w, GetReqInfo(ctx), err); wrErr != nil { reqLogOrDefault(ctx, cfg.Log).Error(logs.FailedToWriteResponse, zap.Error(wrErr)) }