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

Check whether credentials are missing before using them #1181

Merged
merged 1 commit into from
Jan 5, 2023

Conversation

wallyqs
Copy link
Member

@wallyqs wallyqs commented Jan 4, 2023

On nats.Connect only the last error when attempting to connect will be reported, so a failure to connect with a bad configuration will result in no servers available in case there are multiple servers discovered or configured. In case of using credentials, this will hide issues like not configuring correctly the path to the credentials and just getting an Authorization Error for example as well.
To improve usability we can check whether the creds have been configured correctly when processing the option rather than waiting to connect (have stumbled upon this issue a couple of times so this should improve usability).

Also started to adopt wrapping errors syntax to check for the underlying io error.

Signed-off-by: Waldemar Quevedo wally@nats.io

@wallyqs wallyqs requested review from bruth and piotrpio January 4, 2023 19:29
Signed-off-by: Waldemar Quevedo <wally@nats.io>
Copy link
Member

@bruth bruth left a comment

Choose a reason for hiding this comment

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

Looks great!

@wallyqs wallyqs merged commit d5a4d04 into main Jan 5, 2023
@wallyqs wallyqs deleted the check-creds-missing branch January 5, 2023 16:14
@piotrpio piotrpio mentioned this pull request Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants