Skip to content

Commit 3c994e7

Browse files
authored
fix: Update error message when PR automation is not found (#99)
1 parent 4f7a3c3 commit 3c994e7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

example/prautomation/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
plural = {
44
source = "pluralsh/plural"
5-
version = "0.2.1"
5+
version = "0.2.27"
66
}
77
}
88
}

internal/datasource/pr_automation.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,22 @@ func (r *PRAutomationDataSource) Read(ctx context.Context, req datasource.ReadRe
9696
var fragment *console.PrAutomationFragment
9797
if !data.Id.IsNull() {
9898
if c, err := r.client.GetPrAutomation(ctx, data.Id.ValueString()); err != nil {
99-
resp.Diagnostics.AddWarning("Client Error", fmt.Sprintf("Unable to read PR automation by ID, got error: %s", err))
99+
resp.Diagnostics.AddWarning("Client Error", fmt.Sprintf("Unable to find PR automation by ID, got error: %s", err))
100100
} else {
101101
fragment = c.PrAutomation
102102
}
103103
}
104104

105105
if fragment == nil && !data.Name.IsNull() {
106106
if c, err := r.client.GetPrAutomationByName(ctx, data.Name.ValueString()); err != nil {
107-
resp.Diagnostics.AddWarning("Client Error", fmt.Sprintf("Unable to read PR automation by name, got error: %s", err))
107+
resp.Diagnostics.AddWarning("Client Error", fmt.Sprintf("Unable to find PR automation by name, got error: %s", err))
108108
} else {
109109
fragment = c.PrAutomation
110110
}
111111
}
112112

113113
if fragment == nil {
114-
resp.Diagnostics.AddError("Client Error", "Unable to read PR automation, see warnings for more information")
114+
resp.Diagnostics.AddError("Client Error", "PR automation not found")
115115
return
116116
}
117117

0 commit comments

Comments
 (0)