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

returning errors back to the client. #990

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pulsar/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ func NewAuthenticationAthenz(authParams map[string]string) Authentication {
}

// NewAuthenticationOAuth2 Creates OAuth2 Authentication provider
func NewAuthenticationOAuth2(authParams map[string]string) Authentication {
oauth, _ := auth.NewAuthenticationOAuth2WithParams(authParams)
return oauth
func NewAuthenticationOAuth2(authParams map[string]string) (Authentication, error) {
oauth, err := auth.NewAuthenticationOAuth2WithParams(authParams)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you should change the return value.

You can add a new method or use panic here.

Copy link
Author

Choose a reason for hiding this comment

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

Okay. I dont think I will do a panic/fatal or in any other way exit with an error in a function like that. But I guess that could be a matter of personal preference or coding style.

So just to be clear we're talking about the same; your suggestion would be to make another function called something like NewAuthenticationOAuth2withErrorHandling, correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

In principal, the modifications that modify the public APIs should not be accepted. /cc @shibd

return oauth, err
}

// NewAuthenticationBasic Creates Basic Authentication provider
Expand Down