Skip to content

Commit

Permalink
Use a constant for the report message
Browse files Browse the repository at this point in the history
Uses a constant for the report message so we can call it where needed.
  • Loading branch information
mitchnielsen committed Jun 13, 2024
1 parent 0f5788c commit d0b5fb8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/provider/helpers/diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import (
"github.com/hashicorp/terraform-plugin-framework/diag"
)

// https://developer.hashicorp.com/terraform/plugin/framework/diagnostics#custom-diagnostics-types
const (
reportMessage = "Please report this issue to the provider developers."
)

// CreateClientErrorDiagnostic returns an error diagnostic for when one of the
// HTTP clients failed to be instantiated.
Expand All @@ -15,7 +17,7 @@ import (
func CreateClientErrorDiagnostic(clientName string, err error) diag.Diagnostic {
return diag.NewErrorDiagnostic(
fmt.Sprintf("Error creating %s client", clientName),
fmt.Sprintf("Could not create %s client, due to error: %s. If you believe this to be a bug in the provider, please report this to the maintainers.", clientName, err.Error()),
fmt.Sprintf("Could not create %s client, due to error: %s. %s", clientName, err.Error(), reportMessage),
)
}

Expand Down

0 comments on commit d0b5fb8

Please sign in to comment.