Ensuring we output the error when things fail

This commit is contained in:
tombuildsstuff 2017-04-12 11:44:07 +01:00
parent 01c8b0197c
commit 70e69a7387
3 changed files with 8 additions and 9 deletions

View File

@ -144,7 +144,7 @@ func resourceArmEventHubAuthorizationRuleRead(d *schema.ResourceData, meta inter
resp, err := client.GetAuthorizationRule(resGroup, namespaceName, eventHubName, name)
if err != nil {
return fmt.Errorf("Error making Read request on Azure EventHub Authorization Rule %s: %s", name, err)
return fmt.Errorf("Error making Read request on Azure EventHub Authorization Rule %s: %+v", name, err)
}
if resp.StatusCode == http.StatusNotFound {
d.SetId("")
@ -153,7 +153,7 @@ func resourceArmEventHubAuthorizationRuleRead(d *schema.ResourceData, meta inter
keysResp, err := client.ListKeys(resGroup, namespaceName, eventHubName, name)
if err != nil {
return fmt.Errorf("Error making Read request on Azure EventHub Authorization Rule List Keys %s: %s", name, err)
return fmt.Errorf("Error making Read request on Azure EventHub Authorization Rule List Keys %s: %+v", name, err)
}
d.Set("name", name)
@ -187,7 +187,7 @@ func resourceArmEventHubAuthorizationRuleDelete(d *schema.ResourceData, meta int
resp, err := eventhubClient.DeleteAuthorizationRule(resGroup, namespaceName, eventHubName, name)
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("Error issuing Azure ARM delete request of EventHub Authorization Rule '%s': %s", name, err)
return fmt.Errorf("Error issuing Azure ARM delete request of EventHub Authorization Rule '%s': %+v", name, err)
}
return nil

View File

@ -109,7 +109,7 @@ func resourceArmEventHubConsumerGroupRead(d *schema.ResourceData, meta interface
resp, err := eventhubClient.Get(resGroup, namespaceName, eventHubName, name)
if err != nil {
return fmt.Errorf("Error making Read request on Azure EventHub Consumer Group %s: %s", name, err)
return fmt.Errorf("Error making Read request on Azure EventHub Consumer Group %s: %+v", name, err)
}
if resp.StatusCode == http.StatusNotFound {
d.SetId("")
@ -141,7 +141,7 @@ func resourceArmEventHubConsumerGroupDelete(d *schema.ResourceData, meta interfa
resp, err := eventhubClient.Delete(resGroup, namespaceName, eventHubName, name)
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("Error issuing Azure ARM delete request of EventHub Consumer Group '%s': %s", name, err)
return fmt.Errorf("Error issuing Azure ARM delete request of EventHub Consumer Group '%s': %+v", name, err)
}
return nil

View File

@ -131,7 +131,7 @@ func resourceArmEventHubNamespaceRead(d *schema.ResourceData, meta interface{})
resp, err := namespaceClient.Get(resGroup, name)
if err != nil {
return fmt.Errorf("Error making Read request on Azure EventHub Namespace %s: %s", name, err)
return fmt.Errorf("Error making Read request on Azure EventHub Namespace %s: %+v", name, err)
}
if resp.StatusCode == http.StatusNotFound {
d.SetId("")
@ -146,7 +146,7 @@ func resourceArmEventHubNamespaceRead(d *schema.ResourceData, meta interface{})
keys, err := namespaceClient.ListKeys(resGroup, name, eventHubNamespaceDefaultAuthorizationRule)
if err != nil {
log.Printf("[ERROR] Unable to List default keys for Namespace %s: %s", name, err)
log.Printf("[ERROR] Unable to List default keys for Namespace %s: %+v", name, err)
} else {
d.Set("default_primary_connection_string", keys.PrimaryConnectionString)
d.Set("default_secondary_connection_string", keys.SecondaryConnectionString)
@ -160,7 +160,6 @@ func resourceArmEventHubNamespaceRead(d *schema.ResourceData, meta interface{})
}
func resourceArmEventHubNamespaceDelete(d *schema.ResourceData, meta interface{}) error {
namespaceClient := meta.(*ArmClient).eventHubNamespacesClient
id, err := parseAzureResourceID(d.Id())
@ -173,7 +172,7 @@ func resourceArmEventHubNamespaceDelete(d *schema.ResourceData, meta interface{}
resp, err := namespaceClient.Delete(resGroup, name, make(chan struct{}))
if resp.StatusCode != http.StatusNotFound {
return fmt.Errorf("Error issuing Azure ARM delete request of EventHub Namespace'%s': %s", name, err)
return fmt.Errorf("Error issuing Azure ARM delete request of EventHub Namespace '%s': %+v", name, err)
}
return nil