@@ -5,6 +5,7 @@ package power
55
66import (
77 "context"
8+ "fmt"
89 "log"
910
1011 "github.com/IBM-Cloud/power-go-client/clients/instance"
@@ -185,7 +186,9 @@ func DataSourceIBMPIVolume() *schema.Resource {
185186func dataSourceIBMPIVolumeRead (ctx context.Context , d * schema.ResourceData , meta any ) diag.Diagnostics {
186187 sess , err := meta .(conns.ClientSession ).IBMPISession ()
187188 if err != nil {
188- return diag .FromErr (err )
189+ tfErr := flex .TerraformErrorf (err , fmt .Sprintf ("IBMPISession failed: %s" , err .Error ()), "(Data) ibm_pi_volume" , "read" )
190+ log .Printf ("[DEBUG]\n %s" , tfErr .GetDebugMessage ())
191+ return tfErr .GetDiag ()
189192 }
190193
191194 cloudInstanceID := d .Get (Arg_CloudInstanceID ).(string )
@@ -199,7 +202,9 @@ func dataSourceIBMPIVolumeRead(ctx context.Context, d *schema.ResourceData, meta
199202 volumeC := instance .NewIBMPIVolumeClient (ctx , sess , cloudInstanceID )
200203 volumedata , err := volumeC .Get (volumeID )
201204 if err != nil {
202- return diag .FromErr (err )
205+ tfErr := flex .TerraformErrorf (err , fmt .Sprintf ("Get failed: %s" , err .Error ()), "(Data) ibm_pi_volume" , "read" )
206+ log .Printf ("[DEBUG]\n %s" , tfErr .GetDebugMessage ())
207+ return tfErr .GetDiag ()
203208 }
204209
205210 d .SetId (* volumedata .VolumeID )
0 commit comments