From 2bb6c0fc2f792e0258620f01a4994d41d37dd368 Mon Sep 17 00:00:00 2001 From: Erik Merkle Date: Tue, 10 May 2022 13:06:51 -0500 Subject: [PATCH] Add error log in case role retrieval fails --- internal/provider/data_source_role.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/provider/data_source_role.go b/internal/provider/data_source_role.go index 30e38b4..6eb1556 100644 --- a/internal/provider/data_source_role.go +++ b/internal/provider/data_source_role.go @@ -102,6 +102,9 @@ func listRole(ctx context.Context, client *astra.ClientWithResponses, roleID str return nil, err } + if resp.StatusCode() > 200 { + return nil, fmt.Errorf("Fetching role \"%s\" was not successful. Message: %s", roleID, string(resp.Body)) + } roleRaw := (*resp.JSON200).(map[string]interface{}) return roleRaw, err