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

Client API design, two sources for error #37

Closed
swdee opened this issue Sep 8, 2020 · 1 comment
Closed

Client API design, two sources for error #37

swdee opened this issue Sep 8, 2020 · 1 comment

Comments

@swdee
Copy link

swdee commented Sep 8, 2020

The design of this client library seems unusual to me as querying requires checking two sources for error instead of an expected single source.

The documentation checks err from client.Execute() as well as nebula.IsError(resp) such as in the following code from the readme.

  resp, err := client.Execute("SHOW HOSTS;")
  if err != nil {
    log.Fatal(err)
  }

  if nebula.IsError(resp) {
    log.Printf("ErrorCode: %v, ErrorMsg: %s", resp.GetErrorCode(), resp.GetErrorMsg())
  }

Why are two sources of error checking done and not one?

My expectation would be a single check such as;

resp, err := client.Execute("SHOW HOSTS;")

if err != nil {
    log.Printf("ErrorCode: %v, ErrorMsg: %s", resp.GetErrorCode(), resp.GetErrorMsg())
}
@Aiee
Copy link
Contributor

Aiee commented Jun 28, 2021

Thank you for your feedback.
We have updated the error handling, as the detailed design-relative changes are explained in #40

Please feel free to open new issues, feedbacks/suggestions are always welcome.

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

No branches or pull requests

2 participants