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

Non-success status codes should not always result in a thrown exception #30

Merged
merged 4 commits into from
Jun 11, 2024

Conversation

hlship
Copy link
Contributor

@hlship hlship commented May 24, 2024

There are cases where a valid request to GitHub may result in a 404, and dealing with that as a thrown exception, rather than a status code, is problematic.

Also, bumped many deps to latest, except where that causes a conflict with JDK 1.8.

@hlship hlship added the enhancement New feature or request label May 24, 2024
@hlship hlship self-assigned this May 24, 2024
@hlship hlship requested a review from phmeier-nubank May 24, 2024 23:50
Copy link
Contributor

@phmeier-nubank phmeier-nubank left a comment

Choose a reason for hiding this comment

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

LGTM. Some improvements suggested but they should not hold up the release train.

image

[nubank/state-flow "5.14.0"]
[clj-commons/fs "1.6.310"]
[nubank/state-flow "5.17.0"]
[clj-commons/fs "1.6.311"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Are the version bumps essential to this PR? Otherwise separate them out at least to a separate commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When the cost of getting a commit merged is too high, you tend to put a lot into one PR. These changes are not essential, but I tend to update dependencies as hygiene, when possible.


:throw? - if true (the default), then non-success status codes result in a thrown exception.
If set to false, then the response is returned, regardless and the caller can decide what to do
with failure statuses."
Copy link
Contributor

Choose a reason for hiding this comment

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

💯 for adding better docs.

Maybe specific what non-success status codes are, just to be sure. You can refer to the success-codes function.

Also add that in case of success the response body is conditionally parsed into json as returned as a clojure data structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding docs is what I do ™️.

{:status 404}]
(is (match?
{:status 404}
(sut/request client {:throw? false})))))
Copy link
Contributor

@phmeier-nubank phmeier-nubank Jun 11, 2024

Choose a reason for hiding this comment

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

You should also verify that the headers and body are not mangled.

@hlship
Copy link
Contributor Author

hlship commented Jun 11, 2024

Thanks for the review; I'll make some changes and merge.

@hlship hlship merged commit ea5501f into main Jun 11, 2024
2 checks passed
@hlship hlship deleted the hls/bump-deps-24may2024 branch June 11, 2024 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants