@@ -185,6 +185,13 @@ func (c *controller) GetAllInstances(ctx context.Context) ([]Instance, error) {
185185 return nil , fmt .Errorf ("failed to parse response body %q: %w" , string (body ), err )
186186 }
187187
188+ log .ConditionalColorf ("got %d instances back from controller\n " , len (response .Instances ))
189+ body , err = json .Marshal (response )
190+ if err != nil {
191+ return nil , fmt .Errorf ("failed to marshal response body %q: %w" , string (body ), err )
192+ }
193+ log .ConditionalColorf ("instances response: %s\n " , string (body ))
194+
188195 var instances []Instance
189196 for _ , instanceWrapper := range response .Instances {
190197 instances = append (instances , * instanceWrapper .Instance )
@@ -195,9 +202,11 @@ func (c *controller) GetAllInstances(ctx context.Context) ([]Instance, error) {
195202
196203func (c * controller ) GetInstanceByExternalId (ctx context.Context , externalId string ) (* Instance , error ) {
197204 instances , err := c .GetAllInstances (ctx )
205+
198206 if len (instances ) == 0 {
199- return nil , fmt .Errorf ("no instances returned from controller" )
207+ return nil , fmt .Errorf ("no instances returned from controller: %w" , err )
200208 }
209+
201210 if err != nil {
202211 return nil , fmt .Errorf ("failed to get instance by external id %s: %w" , externalId , err )
203212 }
0 commit comments