Skip to content

Commit bed73f8

Browse files
committed
Improve log messages
1 parent d88d6c7 commit bed73f8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

restapi/datasource_api_object.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,15 @@ func dataSourceRestApiRead(d *schema.ResourceData, meta interface{}) error {
7171
search_key := d.Get("search_key").(string)
7272
search_value := d.Get("search_value").(string)
7373
results_key := d.Get("results_key").(string)
74-
if debug { log.Printf("datasource_api_object.go:\npath: %s\nquery_string: %s\nsearch_key: %s\nsearch_value: %s\nresults_key: %s", path, query_string, search_key, search_value, results_key) }
7574

7675
/* Allow user to override provider-level id_attribute */
7776
id_attribute := client.id_attribute
7877
if "" != d.Get("id_attribute").(string) {
7978
id_attribute = d.Get("id_attribute").(string)
8079
}
8180

81+
if debug { log.Printf("datasource_api_object.go:\npath: %s\nquery_string: %s\nsearch_key: %s\nsearch_value: %s\nresults_key: %s\nid_attribute: %s", path, query_string, search_key, search_value, results_key, id_attribute) }
82+
8283
id := ""
8384
var data_array []interface{}
8485
var ok bool
@@ -153,11 +154,11 @@ func dataSourceRestApiRead(d *schema.ResourceData, meta interface{}) error {
153154
return(fmt.Errorf("Failed to find id_attribute '%s' in the record: %s", id_attribute, err))
154155
}
155156

156-
if debug { log.Printf("datasource_api_object.go: Found ID %s", id) }
157+
if debug { log.Printf("datasource_api_object.go: Found ID '%s'", id) }
157158

158159
/* But there is no id attribute??? */
159160
if "" == id {
160-
return(errors.New(fmt.Sprintf("The object for '%s'='%s' did not have the id attribute '%s'", search_key, search_value, id_attribute)))
161+
return(errors.New(fmt.Sprintf("The object for '%s'='%s' did not have the id attribute '%s', or the value was empty.", search_key, search_value, id_attribute)))
161162
}
162163
break
163164
}

0 commit comments

Comments
 (0)