Skip to content

Commit 9ebd75e

Browse files
committed
update defensive checks order
1 parent 13d25bb commit 9ebd75e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

internal/provider/general_api_models.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,17 +288,18 @@ func (d *BaseDataSourceWithOrg) Read(ctx context.Context, req datasource.ReadReq
288288

289289
// Configure adds the provider configured client to the data source.
290290
func (d *BaseDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
291-
// Check that the current context is active
292-
if !IsContextActive("Configure", ctx, resp.Diagnostics) {
293-
return
294-
}
295-
296291
// Check that the response and diagnostics pointer is defined
297292
if resp == nil {
298293
tflog.Error(ctx, "Response not defined, we cannot continue with the execution")
299294
return
300295
}
301296

297+
// Check that the current context is active
298+
if !IsContextActive("Configure", ctx, resp.Diagnostics) {
299+
return
300+
}
301+
302+
// Check that the provider data is configured
302303
if req.ProviderData == nil {
303304
return
304305
}

0 commit comments

Comments
 (0)