Skip to content

Commit 51e33d7

Browse files
authored
Add ID to error messages (#164)
1 parent 4e579c1 commit 51e33d7

23 files changed

+73
-73
lines changed

internal/provider/destination_data_source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (d *destinationDataSource) Read(ctx context.Context, req datasource.ReadReq
8181
}
8282
if err != nil {
8383
resp.Diagnostics.AddError(
84-
"Unable to read Destination",
84+
fmt.Sprintf("Unable to read Destination (ID: %s)", state.ID.ValueString()),
8585
getError(err, body),
8686
)
8787

internal/provider/destination_filter_resource.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func (r *destinationFilterResource) Read(ctx context.Context, req resource.ReadR
202202
}
203203
if err != nil {
204204
resp.Diagnostics.AddError(
205-
"Unable to read Destination Filter",
205+
fmt.Sprintf("Unable to read Destination Filter (ID: %s)", previousState.ID.ValueString()),
206206
getError(err, body),
207207
)
208208

@@ -271,7 +271,7 @@ func (r *destinationFilterResource) Update(ctx context.Context, req resource.Upd
271271
}
272272
if err != nil {
273273
resp.Diagnostics.AddError(
274-
"Unable to update Destination Filter",
274+
fmt.Sprintf("Unable to update Destination Filter (ID: %s)", state.ID.ValueString()),
275275
getError(err, body),
276276
)
277277

@@ -314,7 +314,7 @@ func (r *destinationFilterResource) Delete(ctx context.Context, req resource.Del
314314
}
315315
if err != nil {
316316
resp.Diagnostics.AddError(
317-
"Unable to delete Destination Filter",
317+
fmt.Sprintf("Unable to delete Destination Filter (ID: %s)", state.ID.ValueString()),
318318
getError(err, body),
319319
)
320320

internal/provider/destination_metadata_data_source.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ func (d *destinationMetadataDataSource) Read(ctx context.Context, req datasource
401401
}
402402
if err != nil {
403403
resp.Diagnostics.AddError(
404-
"Unable to read Source metadata",
404+
fmt.Sprintf("Unable to read Source metadata (ID: %s)", state.ID.ValueString()),
405405
getError(err, body),
406406
)
407407

@@ -412,7 +412,7 @@ func (d *destinationMetadataDataSource) Read(ctx context.Context, req datasource
412412
err = state.Fill(destinationMetadata)
413413
if err != nil {
414414
resp.Diagnostics.AddError(
415-
"Unable to read Source metadata",
415+
fmt.Sprintf("Unable to read Source metadata (ID: %s)", state.ID.ValueString()),
416416
err.Error(),
417417
)
418418

internal/provider/destination_resource.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ func (r *destinationResource) Read(ctx context.Context, req resource.ReadRequest
588588
}
589589
if err != nil {
590590
resp.Diagnostics.AddError(
591-
"Unable to read Destination",
591+
fmt.Sprintf("Unable to read Destination (ID: %s)", previousState.ID.ValueString()),
592592
getError(err, body),
593593
)
594594

@@ -650,7 +650,7 @@ func (r *destinationResource) Update(ctx context.Context, req resource.UpdateReq
650650
}
651651
if err != nil {
652652
resp.Diagnostics.AddError(
653-
"Unable to update Destination",
653+
fmt.Sprintf("Unable to update Destination (ID: %s)", plan.ID.ValueString()),
654654
getError(err, body),
655655
)
656656

@@ -695,7 +695,7 @@ func (r *destinationResource) Delete(ctx context.Context, req resource.DeleteReq
695695
}
696696
if err != nil {
697697
resp.Diagnostics.AddError(
698-
"Unable to delete Destination",
698+
fmt.Sprintf("Unable to delete Destination (ID: %s)", state.ID.ValueString()),
699699
getError(err, body),
700700
)
701701

internal/provider/destination_subscription_resource.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func (r *destinationSubscriptionResource) Create(ctx context.Context, req resour
182182
}
183183
if err != nil {
184184
resp.Diagnostics.AddError(
185-
"Unable to update Destination subscription",
185+
fmt.Sprintf("Unable to update Destination subscription (ID: %s)", plan.ID.ValueString()),
186186
getError(err, body),
187187
)
188188

@@ -229,7 +229,7 @@ func (r *destinationSubscriptionResource) Read(ctx context.Context, req resource
229229
}
230230
if err != nil {
231231
resp.Diagnostics.AddError(
232-
"Unable to read Destination subscription",
232+
fmt.Sprintf("Unable to read Destination subscription (ID: %s)", previousState.ID.ValueString()),
233233
getError(err, body),
234234
)
235235

@@ -312,7 +312,7 @@ func (r *destinationSubscriptionResource) Update(ctx context.Context, req resour
312312
}
313313
if err != nil {
314314
resp.Diagnostics.AddError(
315-
"Unable to update Destination subscription",
315+
fmt.Sprintf("Unable to update Destination subscription (ID: %s)", plan.ID.ValueString()),
316316
getError(err, body),
317317
)
318318

@@ -353,7 +353,7 @@ func (r *destinationSubscriptionResource) Delete(ctx context.Context, req resour
353353
}
354354
if err != nil {
355355
resp.Diagnostics.AddError(
356-
"Unable to delete Destination subscription",
356+
fmt.Sprintf("Unable to delete Destination subscription (ID: %s)", config.ID.ValueString()),
357357
getError(err, body),
358358
)
359359

internal/provider/function_resource.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func (r *functionResource) Read(ctx context.Context, req resource.ReadRequest, r
190190
}
191191
if err != nil {
192192
resp.Diagnostics.AddError(
193-
"Unable to read Function",
193+
fmt.Sprintf("Unable to read Function (ID: %s)", previousState.ID.ValueString()),
194194
getError(err, body),
195195
)
196196

@@ -247,7 +247,7 @@ func (r *functionResource) Update(ctx context.Context, req resource.UpdateReques
247247
}
248248
if err != nil {
249249
resp.Diagnostics.AddError(
250-
"Unable to update Function",
250+
fmt.Sprintf("Unable to update Function (ID: %s)", plan.ID.ValueString()),
251251
getError(err, body),
252252
)
253253

@@ -284,7 +284,7 @@ func (r *functionResource) Delete(ctx context.Context, req resource.DeleteReques
284284
}
285285
if err != nil {
286286
resp.Diagnostics.AddError(
287-
"Unable to delete Function",
287+
fmt.Sprintf("Unable to delete Function (ID: %s)", config.ID.ValueString()),
288288
getError(err, body),
289289
)
290290

internal/provider/insert_function_instance_resource.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func (r *insertFunctionInstanceResource) Read(ctx context.Context, req resource.
160160
}
161161
if err != nil {
162162
resp.Diagnostics.AddError(
163-
"Unable to read Insert Function instance",
163+
fmt.Sprintf("Unable to read Insert Function instance (ID: %s)", previousState.ID.ValueString()),
164164
getError(err, body),
165165
)
166166

@@ -227,7 +227,7 @@ func (r *insertFunctionInstanceResource) Update(ctx context.Context, req resourc
227227
}
228228
if err != nil {
229229
resp.Diagnostics.AddError(
230-
"Unable to update Insert Function instance",
230+
fmt.Sprintf("Unable to update Insert Function instance (ID: %s)", plan.ID.ValueString()),
231231
getError(err, body),
232232
)
233233

@@ -271,7 +271,7 @@ func (r *insertFunctionInstanceResource) Delete(ctx context.Context, req resourc
271271
}
272272
if err != nil {
273273
resp.Diagnostics.AddError(
274-
"Unable to delete Insert Function instance",
274+
fmt.Sprintf("Unable to delete Insert Function instance (ID: %s)", config.ID.ValueString()),
275275
getError(err, body),
276276
)
277277

internal/provider/profiles_warehouse_resource.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func (r *profilesWarehouseResource) Read(ctx context.Context, req resource.ReadR
168168
warehouse, err := findProfileWarehouse(r.authContext, r.client, previousState.ID.ValueString(), previousState.SpaceID.ValueString())
169169
if err != nil {
170170
resp.Diagnostics.AddError(
171-
"Unable to read Profiles Warehouse",
171+
fmt.Sprintf("Unable to read Profiles Warehouse (ID: %s)", previousState.ID.ValueString()),
172172
err.Error(),
173173
)
174174

@@ -240,7 +240,7 @@ func (r *profilesWarehouseResource) Update(ctx context.Context, req resource.Upd
240240
}
241241
if err != nil {
242242
resp.Diagnostics.AddError(
243-
"Unable to update Profiles Warehouse",
243+
fmt.Sprintf("Unable to update Profiles Warehouse (ID: %s)", plan.ID.ValueString()),
244244
getError(err, body),
245245
)
246246

@@ -283,7 +283,7 @@ func (r *profilesWarehouseResource) Delete(ctx context.Context, req resource.Del
283283
}
284284
if err != nil {
285285
resp.Diagnostics.AddError(
286-
"Unable to delete Profiles Warehouse",
286+
fmt.Sprintf("Unable to delete Profiles Warehouse (ID: %s)", config.ID.ValueString()),
287287
getError(err, body),
288288
)
289289

internal/provider/reverse_etl_model_resource.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func (r *reverseETLModelResource) Read(ctx context.Context, req resource.ReadReq
161161
}
162162
if err != nil {
163163
resp.Diagnostics.AddError(
164-
"Unable to read Reverse ETL model",
164+
fmt.Sprintf("Unable to read Reverse ETL model (ID: %s)", previousState.ID.ValueString()),
165165
getError(err, body),
166166
)
167167

@@ -222,7 +222,7 @@ func (r *reverseETLModelResource) Update(ctx context.Context, req resource.Updat
222222
}
223223
if err != nil {
224224
resp.Diagnostics.AddError(
225-
"Unable to update Reverse ETL model",
225+
fmt.Sprintf("Unable to update Reverse ETL model (ID: %s)", plan.ID.ValueString()),
226226
getError(err, body),
227227
)
228228

@@ -264,7 +264,7 @@ func (r *reverseETLModelResource) Delete(ctx context.Context, req resource.Delet
264264
}
265265
if err != nil {
266266
resp.Diagnostics.AddError(
267-
"Unable to delete Reverse ETL model",
267+
fmt.Sprintf("Unable to delete Reverse ETL model (ID: %s)", config.ID.ValueString()),
268268
getError(err, body),
269269
)
270270

internal/provider/role_data_source.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (d *roleDataSource) Read(ctx context.Context, req datasource.ReadRequest, r
9090
}
9191
if err != nil {
9292
resp.Diagnostics.AddError(
93-
"Unable to read Role",
93+
fmt.Sprintf("Unable to read Role (ID: %s)", config.ID.ValueString()),
9494
getError(err, body),
9595
)
9696

@@ -100,7 +100,7 @@ func (d *roleDataSource) Read(ctx context.Context, req datasource.ReadRequest, r
100100
role, err := findRole(out.Data.Roles, id)
101101
if err != nil {
102102
resp.Diagnostics.AddError(
103-
"Unable to read Role",
103+
fmt.Sprintf("Unable to read Role (ID: %s)", config.ID.ValueString()),
104104
err.Error(),
105105
)
106106

0 commit comments

Comments
 (0)