Skip to content

Commit

Permalink
Fix error handling on objecto storage service enablement
Browse files Browse the repository at this point in the history
  • Loading branch information
vicentepinto98 committed Dec 18, 2023
1 parent 35275fd commit 2338fdd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion stackit/internal/services/objectstorage/bucket/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (r *bucketResource) Create(ctx context.Context, req resource.CreateRequest,

// Handle project init
err := enableProject(ctx, &model, r.client)
if resp.Diagnostics.HasError() {
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating bucket", fmt.Sprintf("Enabling object storage project before creation: %v", err))
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (r *credentialResource) Create(ctx context.Context, req resource.CreateRequ

// Handle project init
err := enableProject(ctx, &model, r.client)
if resp.Diagnostics.HasError() {
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Enabling object storage project before creation: %v", err))
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (r *credentialsGroupResource) Create(ctx context.Context, req resource.Crea

// Handle project init
err := enableProject(ctx, &model, r.client)
if resp.Diagnostics.HasError() {
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credentials group", fmt.Sprintf("Enabling object storage project before creation: %v", err))
return
}
Expand Down

0 comments on commit 2338fdd

Please sign in to comment.