Skip to content

Commit

Permalink
expand error text
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismarget-j committed Oct 20, 2024
1 parent 09f975c commit 5b89f75
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (o *resourceDatacenterConnectivityTemplateAssignments) Create(ctx context.C
err = bp.SetApplicationPointsConnectivityTemplates(ctx, request)
if err != nil {
resp.Diagnostics.AddError(
fmt.Sprintf("failed while assigning Connectivity Template %s to Application Points", plan.ConnectivityTemplateId),
fmt.Sprintf("failed while assigning Connectivity Template %s to Application Points %s", plan.ConnectivityTemplateId, plan.ApplicationPointIds),
err.Error())
}

Expand Down Expand Up @@ -182,7 +182,7 @@ func (o *resourceDatacenterConnectivityTemplateAssignments) Update(ctx context.C
err = bp.SetApplicationPointsConnectivityTemplates(ctx, request)
if err != nil {
resp.Diagnostics.AddError(
fmt.Sprintf("failed while assigning Connectivity Template %s to Application Points", plan.ConnectivityTemplateId),
fmt.Sprintf("failed while assigning Connectivity Template %s to Application Points %s", plan.ConnectivityTemplateId, plan.ApplicationPointIds),
err.Error())
}

Expand Down
10 changes: 8 additions & 2 deletions apstra/resource_datacenter_connectivity_templates_assignment.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ func (o *resourceDatacenterConnectivityTemplatesAssignment) Create(ctx context.C
addIds, _ := plan.AddDelRequest(ctx, nil, &resp.Diagnostics)
err = bp.SetApplicationPointConnectivityTemplates(ctx, apstra.ObjectId(plan.ApplicationPointId.ValueString()), addIds)
if err != nil {
resp.Diagnostics.AddError("failed applying Connectivity Template", err.Error())
resp.Diagnostics.AddError(
fmt.Sprintf("failed while assigning Connectivity Templates %s to Application Point %s", plan.ConnectivityTemplateIds, plan.ApplicationPointId),
err.Error(),
)
return
}

Expand Down Expand Up @@ -178,7 +181,10 @@ func (o *resourceDatacenterConnectivityTemplatesAssignment) Update(ctx context.C
// add any required CTs
err = bp.SetApplicationPointConnectivityTemplates(ctx, apstra.ObjectId(plan.ApplicationPointId.ValueString()), addIds)
if err != nil {
resp.Diagnostics.AddError("failed assigning connectivity templates", err.Error())
resp.Diagnostics.AddError(
fmt.Sprintf("failed while assigning Connectivity Templates %s to Application Point %s", plan.ConnectivityTemplateIds, plan.ApplicationPointId),
err.Error(),
)
return
}

Expand Down

0 comments on commit 5b89f75

Please sign in to comment.