Don't return InternalError if possible #143

Closed
opened 2023-06-16 07:39:44 +00:00 by dkirillov · 1 comment
Collaborator

We have function that forms s3 errors to return to the client.
And if the error is already well formed s3 error it's returned as is.

But sometimes initial error is wrapped and we get InternalError

Expected Behavior

Getting EntityTooSmall error

Current Behavior

Getting InternalError error

Possible Solution

Unwrap s3 errors here before checking

Steps to Reproduce (for bugs)

  1. Init multipart upload
  2. Upload two parts with size less than 5mb
  3. Try to complete multipart upload

Your Environment

We have function that [forms s3 errors](https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/src/commit/751d66bde0bf94c7a59b68c188ef11a289f68bc3/api/handler/util.go#L45) to return to the client. And if the error is already well formed s3 error it's returned as is. But sometimes [initial error](https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/src/commit/751d66bde0bf94c7a59b68c188ef11a289f68bc3/api/layer/multipart_upload.go#L393) is [wrapped](https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/src/commit/751d66bde0bf94c7a59b68c188ef11a289f68bc3/api/handler/multipart_upload.go#L448-L451) and we get `InternalError` ## Expected Behavior Getting `EntityTooSmall` error ## Current Behavior Getting `InternalError` error ## Possible Solution Unwrap s3 errors [here](https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/src/commit/751d66bde0bf94c7a59b68c188ef11a289f68bc3/api/handler/util.go#L46) before checking ## Steps to Reproduce (for bugs) 1. Init multipart upload 2. Upload two parts with size less than 5mb 3. Try to complete multipart upload ## Your Environment * Version used: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/commit/751d66bde0bf94c7a59b68c188ef11a289f68bc3
dkirillov added the
bug
label 2023-06-16 07:39:44 +00:00
dkirillov self-assigned this 2023-06-21 14:17:40 +00:00

Done in #148

Done in #148
dkirillov referenced this issue from a commit 2023-07-06 09:25:17 +00:00
alexvanin added this to the v0.28.0 milestone 2023-07-12 09:40:17 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-s3-gw#143
There is no content yet.