@@ -219,18 +219,21 @@ func readApiConfig(ctx context.Context, data *SettingsResourceModel, client *api
219
219
return diag.Diagnostics {diag .NewErrorDiagnostic ("Client Error" , msg )}
220
220
}
221
221
// Deleted project is an orphan resource, not returning error so it can be destroyed.
222
- if httpResp .StatusCode () == http .StatusNotFound {
222
+ switch httpResp .StatusCode () {
223
+ case http .StatusNotFound , http .StatusNotAcceptable :
223
224
return nil
225
+ default :
226
+ break
224
227
}
225
228
if httpResp .JSON200 == nil {
226
- msg := fmt .Sprintf ("Unable to read api settings, got error : %s" , httpResp .Body )
229
+ msg := fmt .Sprintf ("Unable to read api settings, got status %d : %s" , httpResp . StatusCode () , httpResp .Body )
227
230
return diag.Diagnostics {diag .NewErrorDiagnostic ("Client Error" , msg )}
228
231
}
229
232
230
233
httpResp .JSON200 .JwtSecret = nil
231
234
value , err := json .Marshal (* httpResp .JSON200 )
232
235
if err != nil {
233
- msg := fmt .Sprintf ("Unable to read api settings, got error: %s" , err )
236
+ msg := fmt .Sprintf ("Unable to read api settings, got marshal error: %s" , err )
234
237
return diag.Diagnostics {diag .NewErrorDiagnostic ("Client Error" , msg )}
235
238
}
236
239
@@ -250,13 +253,13 @@ func updateApiConfig(ctx context.Context, data *SettingsResourceModel, client *a
250
253
return diag.Diagnostics {diag .NewErrorDiagnostic ("Client Error" , msg )}
251
254
}
252
255
if httpResp .JSON200 == nil {
253
- msg := fmt .Sprintf ("Unable to update api settings, got error : %s" , httpResp .Body )
256
+ msg := fmt .Sprintf ("Unable to update api settings, got status %d : %s" , httpResp . StatusCode () , httpResp .Body )
254
257
return diag.Diagnostics {diag .NewErrorDiagnostic ("Client Error" , msg )}
255
258
}
256
259
257
260
value , err := json .Marshal (* httpResp .JSON200 )
258
261
if err != nil {
259
- msg := fmt .Sprintf ("Unable to update api settings, got error: %s" , err )
262
+ msg := fmt .Sprintf ("Unable to update api settings, got marshal error: %s" , err )
260
263
return diag.Diagnostics {diag .NewErrorDiagnostic ("Client Error" , msg )}
261
264
}
262
265
0 commit comments