Skip to content

Commit

Permalink
Implementing ToErrorResponse method
Browse files Browse the repository at this point in the history
  • Loading branch information
alanprot committed Sep 6, 2023
1 parent 1b257a3 commit 5190475
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions providers/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,3 +638,37 @@ func NewTestBucketFromConfig(t testing.TB, location string, c Config, reuseBucke
func ContextWithSSEConfig(ctx context.Context, value encrypt.ServerSide) context.Context {
return context.WithValue(ctx, sseConfigKey, value)
}

/* **** SAMPLE ERROR RESPONSE ****
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<BucketName>bucketName</BucketName>
<Key>objectName</Key>
<RequestId>F19772218238A85A</RequestId>
<HostId>GuWkjyviSiGHizehqpmsD1ndz5NClSP19DOT+s2mv7gXGQ8/X1lhbDGiIJEXpGFD</HostId>
</Error>
*/

type ErrorResponse struct {
Code string
Message string
BucketName string
Key string
RequestId string
HostId string
}

// ToErrorResponse Returns parsed s3 ErrorResponse

Check failure on line 663 in providers/s3/s3.go

View workflow job for this annotation

GitHub Actions / Linters (Static Analysis) for Go

Comment should end in a period (godot)
func ToErrorResponse(err error) ErrorResponse {
er := minio.ToErrorResponse(errors.Cause(err))
return ErrorResponse{
Code: er.Code,
Message: er.Message,
BucketName: er.BucketName,
Key: er.Key,
RequestId: er.RequestID,
HostId: er.HostID,
}
}

0 comments on commit 5190475

Please sign in to comment.