Skip to content
This repository was archived by the owner on Jun 27, 2021. It is now read-only.

Commit 7a7a8a3

Browse files
Tjeerd RitsmaDeviaVir
Tjeerd Ritsma
authored andcommitted
Add mention of the group email when an error occurs (#106)
1 parent 659a74f commit 7a7a8a3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

gsuite/data_group_settings.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func dataGroupSettingsRead(d *schema.ResourceData, meta interface{}) error {
252252

253253
id, err := config.groupSettings.Groups.Get(d.Get("email").(string)).Do()
254254
if err != nil {
255-
return fmt.Errorf("[ERROR] Error fetching group settings. Make sure the group exists: %s ", err)
255+
return fmt.Errorf("[ERROR] Error fetching group settings. Make sure the group '%s' exists: %s ", d.Get("email").(string), err)
256256
}
257257

258258
d.SetId(d.Get("email").(string))

gsuite/resource_group_settings.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ func resourceGroupSettingsCreate(d *schema.ResourceData, meta interface{}) error
440440
return err
441441
}, config.TimeoutMinutes)
442442
if err != nil {
443-
return fmt.Errorf("[ERROR] Something went wrong while updating group settings: %s", err)
443+
return fmt.Errorf("[ERROR] Something went wrong while updating group settings for '%s': %s", d.Get("email").(string), err)
444444
}
445445

446446
return resourceGroupSettingsRead(d, meta)
@@ -722,7 +722,7 @@ func resourceGroupSettingsUpdate(d *schema.ResourceData, meta interface{}) error
722722
}, config.TimeoutMinutes)
723723

724724
if err != nil {
725-
return fmt.Errorf("[ERROR] Error updating group settings: %s", err)
725+
return fmt.Errorf("[ERROR] Error updating group settings for '%s': %s", d.Get("email").(string), err)
726726
}
727727

728728
return resourceGroupSettingsRead(d, meta)
@@ -784,7 +784,7 @@ func resourceGroupSettingsImporter(d *schema.ResourceData, meta interface{}) ([]
784784

785785
id, err := config.groupSettings.Groups.Get(d.Id()).Do()
786786
if err != nil {
787-
return nil, fmt.Errorf("[ERROR] Error fetching group settings. Make sure the group exists: %s ", err)
787+
return nil, fmt.Errorf("[ERROR] Error fetching group settings. Make sure the group '%s' exists: %s ", d.Id(), err)
788788
}
789789

790790
d.SetId(d.Id())

0 commit comments

Comments
 (0)