fix(storage/s3):lab4 fail fast when bucket does not exist and chore deps

This commit is contained in:
Голиков Maximillian Антон
2026-10-21 10:49:06 +03:00
parent 6fb1e27375
commit 0e5b7375d5
3 changed files with 14 additions and 26 deletions
+5 -1
View File
@@ -34,9 +34,13 @@ func New(ctx context.Context, cfg Config) (*MinioStorage, error) {
return nil, err
}
if _, err := client.BucketExists(ctx, cfg.Bucket); err != nil {
exists, err := client.BucketExists(ctx, cfg.Bucket)
if err != nil {
return nil, mapError(err)
}
if !exists {
return nil, &domain.UnavailableError{Reason: "s3 bucket отсутствует"}
}
return &MinioStorage{client: client, bucket: cfg.Bucket}, nil
}