From d6f016e5b0b5b52a5065fc68d5fee27e06ea788d Mon Sep 17 00:00:00 2001 From: SREallyMatt <106555974+SREallyMatt@users.noreply.github.com> Date: Thu, 7 Nov 2024 10:50:16 -0700 Subject: [PATCH] Changed order of condition, check for parse errors first --- internal/broker/utilities.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/broker/utilities.go b/internal/broker/utilities.go index 87f66a95..ff62c698 100644 --- a/internal/broker/utilities.go +++ b/internal/broker/utilities.go @@ -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())