fix(storage/s3):lab4 fail fast when bucket does not exist and chore deps
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user