Skip to content

Commit

Permalink
Changed order of condition, check for parse errors first
Browse files Browse the repository at this point in the history
  • Loading branch information
sreallymatt committed Nov 7, 2024
1 parent 793b7f3 commit d6f016e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/broker/utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ func client(providerData *providerData) (*semp.Client, diag.Diagnostic) {
}
}
url, err := stringWithDefaultFromEnv(providerData.Url, "url")
if url == "" {
return nil, diag.NewErrorDiagnostic("`url` attribute must be defined in a provider block or set as an environment variable (`SOLACEBROKER_URL`)", semp.ErrProviderParametersError.Error())
}
if err != nil {
return nil, diag.NewErrorDiagnostic("Unable to parse provider attribute", err.Error())
}
if url == "" {
return nil, diag.NewErrorDiagnostic("`url` attribute must be defined in a provider block or set as an environment variable (`SOLACEBROKER_URL`)", semp.ErrProviderParametersError.Error())
}
retries, err := int64WithDefaultFromEnv(providerData.Retries, "retries", semp.DefaultRetries)
if err != nil {
return nil, diag.NewErrorDiagnostic("Unable to parse provider attribute", err.Error())
Expand Down

0 comments on commit d6f016e

Please sign in to comment.