Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return specific errors when parsing connection strings #21586

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

jhendrixMSFT
Copy link
Member

Include failure details instead of a generic error message. Some other minor cleanup.

  • The purpose of this PR is explained in this or a referenced issue.
  • The PR does not update generated files.
  • Tests are included and/or updated for code changes.
  • Updates to module CHANGELOG.md are included.
  • MIT license headers are included in each file.

Include failure details instead of a generic error message.
Some other minor cleanup.
@github-actions github-actions bot added the App Configuration Azure.ApplicationModel.Configuration label Sep 19, 2023
@jhendrixMSFT jhendrixMSFT merged commit 40b4a53 into Azure:main Sep 19, 2023
@jhendrixMSFT jhendrixMSFT deleted the azappconfig-connstr branch September 19, 2023 17:18
)

const duplicateSection = "duplicate %s section"

for _, seg := range strings.Split(connectionString, ";") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing wrong with the fix but are people actually running into this? I was under the impression that most people don't form connection strings by hand - bug in the portal?

Copy link
Member Author

@jhendrixMSFT jhendrixMSFT Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt it. The generic error message reminded me of COM's E_FAIL which isn't all that helpful. Furthermore, we already know at each point of failure what the problem is, so seems useful to return that info.

var cred *string
var sec *[]byte
// Returns endpoint, cred, secret or an error.
func ParseConnectionString(connectionString string) (string, string, []byte, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point you've got to be considering returning this as a struct...

Copy link
Member Author

@jhendrixMSFT jhendrixMSFT Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it, but it seems like extra ceremony for something that's internal and unlikely to change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App Configuration Azure.ApplicationModel.Configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants