-
Notifications
You must be signed in to change notification settings - Fork 879
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
Conversation
Include failure details instead of a generic error message. Some other minor cleanup.
) | ||
|
||
const duplicateSection = "duplicate %s section" | ||
|
||
for _, seg := range strings.Split(connectionString, ";") { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
...
There was a problem hiding this comment.
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.
Include failure details instead of a generic error message. Some other minor cleanup.