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

apiclient: error on non-2xx response #498

Merged
merged 1 commit into from
Nov 11, 2019

Conversation

etungsten
Copy link
Contributor

@etungsten etungsten commented Nov 9, 2019

Issue #, if available: Fixes #489

Description of changes: Adds a new error type for when response code is not in the 2xx range

Testing:

Launched Thar instance, from the admin container:

bash-5.0# apiclient -u /settings/gibberish
Error: ResponseStatus { code: 404, uri: unix://2f72756e2f6170692e736f636b:0/settings/gibberish }

bash-5.0# echo $?                         
1
                                                                                       
bash-5.0# apiclient -u /settings
{"timezone":"America/Los_Angeles","hostname":"localhost","kubernetes":{"cluster-name":"thar-testing-grounds",
...

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@etungsten etungsten force-pushed the apiclient-bad-response-status branch from 04d87af to c25aa4a Compare November 9, 2019 00:54
Copy link
Contributor

@tjkirch tjkirch left a comment

Choose a reason for hiding this comment

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

LGTM. Would you please show $? in the testing though, since the goal is making sure that's not 0? (You can test the client locally, don't need a full build)

workspaces/api/apiclient/src/lib.rs Outdated Show resolved Hide resolved
Adds a new error type for when response code is not in 2xx range
@etungsten etungsten force-pushed the apiclient-bad-response-status branch from c25aa4a to ea15701 Compare November 9, 2019 17:37
@etungsten
Copy link
Contributor Author

Addresses @tjkirch 's comments:
Updated display trait for ResponseStatus

@etungsten
Copy link
Contributor Author

LGTM. Would you please show $? in the testing though, since the goal is making sure that's not 0? (You can test the client locally, don't need a full build)

Got 1 for the exit code. Updated PR testing description.

bash-5.0# apiclient -u /settings/gibberish
Error: ResponseStatus { code: 404, uri: unix://2f72756e2f6170692e736f636b:0/settings/gibberish }
bash-5.0# echo $?                         
1

Copy link
Contributor

@zmrow zmrow left a comment

Choose a reason for hiding this comment

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

🐢

@etungsten etungsten merged commit 912b2ff into develop Nov 11, 2019
@etungsten etungsten deleted the apiclient-bad-response-status branch November 11, 2019 17:58
@iliana iliana added this to the v0.2.0 milestone Nov 19, 2019
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.

apiclient should error on non-2xx response
4 participants