Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit d5d0bae

Browse files
committed
Fixed comments, and place diagnostic info after the error
1 parent 2de5461 commit d5d0bae

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

octopusdeploy_framework/framework_provider.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ func (p *octopusDeployFrameworkProvider) Configure(ctx context.Context, req prov
7272
resp.Diagnostics.AddError("failed to get root resource", err.Error())
7373
config.SystemInfo.OctopusVersion = "Unknown"
7474
} else {
75-
config.SystemInfo.OctopusVersion = rootResource.Version
75+
// Be defensive here because the client can return an empty root resource
76+
if rootResource.Version == "" {
77+
config.SystemInfo.OctopusVersion = "Unknown"
78+
} else {
79+
config.SystemInfo.OctopusVersion = rootResource.Version
80+
}
7681
}
7782

7883
resp.DataSourceData = &config

octopusdeploy_framework/util/logging.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ func Updated(ctx context.Context, resource string, v ...any) {
4949

5050
// AddDiagnosticError is used to wrap calls to Diagnostics.AddError with additional information about the executable and versions
5151
func AddDiagnosticError(diagnostics *diag.Diagnostics, systemInfo *SystemInfo, message string, err string) {
52-
suffix := "\nPlease ensure these details are included in any error report you raise.\n" +
52+
suffix := "\n\nPlease ensure these details are included in any error report you raise.\n" +
5353
"Executable: " + systemInfo.GetExecutableName() + "\n" +
5454
"Terraform Version: " + systemInfo.TerraformVersion + "\n" +
5555
"Octopus Version: " + systemInfo.OctopusVersion
5656

57-
diagnostics.AddError(message+suffix, err)
57+
diagnostics.AddError(message, err+suffix)
5858
}

0 commit comments

Comments
 (0)