Skip to content

Commit fd8afe5

Browse files
committed
Refactor error message in validateMandatoryConfiguration function
1 parent 0b05017 commit fd8afe5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

httpclient/httpclient_client_configuration.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,12 @@ func validateMandatoryConfiguration(config *ClientConfig) error {
210210
if config.Auth.Password == "" {
211211
missingFields = append(missingFields, "Auth.Password")
212212
}
213-
return fmt.Errorf("either OAuth credentials (ClientID and ClientSecret) or Basic Auth credentials (Username and Password) must be provided")
214213
}
215214

216-
// If there are missing fields, return an error detailing what is missing
215+
// If there are missing fields, construct and return an error message detailing what is missing
217216
if len(missingFields) > 0 {
218-
return fmt.Errorf("mandatory configuration missing: %s", strings.Join(missingFields, ", "))
217+
errorMessage := fmt.Sprintf("Mandatory configuration missing: %s. Ensure that either OAuth credentials (ClientID and ClientSecret) or Basic Auth credentials (Username and Password) are fully provided.", strings.Join(missingFields, ", "))
218+
return fmt.Errorf(errorMessage)
219219
}
220220

221221
// If no fields are missing, return nil indicating the configuration is complete

0 commit comments

Comments
 (0)