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

Implement a specific error type for API responses #284

Merged
merged 1 commit into from
Jan 30, 2025
Merged

Conversation

mssola
Copy link
Contributor

@mssola mssola commented Jan 30, 2025

How to test

$ make build
$ REGCODE=invalid ./out/public-api-demo SLES 15.6 x86_64

Then you will receive a proper message:

public-api-demo: A connect client library demo
1) Setup connection and perform an request
<- fetch token
-> update token
API error: Unknown Registration Code. (code: 401)

@mssola mssola requested a review from felixsch January 30, 2025 14:09
Copy link
Contributor

@felixsch felixsch left a comment

Choose a reason for hiding this comment

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

lgtm 👍

How I reviewed this merge request:

  • Checked the changes for things I want to suggest
  • Ran the public-demo-api command and checked the error returned

As always, if you think I'm missing something which I should test, please let me know! 🚀

cheers,

PS: I'm wondering maybe in the future we should add different types of errors to make it more easy to distinguish between different errors. Is this a thing in golang land?

Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
@mssola mssola merged commit 24d5bdd into main Jan 30, 2025
2 checks passed
@mssola mssola deleted the api-errors branch January 30, 2025 15:31
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