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

Add fine-grained HTTP error exceptions #825

Merged
merged 1 commit into from
Nov 4, 2018

Conversation

jerzykrlk
Copy link
Contributor

  • a hierarchy of HTTP-related exceptions under FeignException.

@kdavisk6 kdavisk6 added enhancement For recommending new capabilities waiting for votes Enhancements or changes proposed that need more support before consideration labels Oct 26, 2018
Copy link
Member

@velo velo left a comment

Choose a reason for hiding this comment

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

I'm good with the change, but, CI is not passing

@jerzykrlk jerzykrlk force-pushed the fine-grained-exceptions branch 2 times, most recently from b27e5ef to f24ac00 Compare October 26, 2018 23:09
@jerzykrlk
Copy link
Contributor Author

I'm sorry about that. Fixed.

@velo velo merged commit d436ca1 into OpenFeign:master Nov 4, 2018
@@ -85,4 +124,100 @@ static FeignException errorExecuting(Request request, IOException cause) {
cause,
null);
}

public static class BadRequest extends FeignException {
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like all the 4xx ones should extend some sort of 4xx exception (say FiengClientException) and the same with 5xx errors (maybe FeignServerException).

@jerzykrlk
Copy link
Contributor Author

Yes, that's how Spring's exception hierarchy looks like.

I have personally neved had to catch Client/Server exceptions with Spring's RestTemplate. I rather catch one-two specific exceptions or all of them. So I skipped them here.

That's my use case, though. If you see the point and would like them here, let me know - I'll try to add another PR with them, early next week.

@rage-shadowman
Copy link
Contributor

rage-shadowman commented Dec 6, 2018

The only point I see is that 4xx means some form of bad request so don't try this again because it will never work, while 5xx means something failed on the server so if you try again later (say after some dependent service comes back online) it might work.

I don't personally have an immediate use for it, but if you are already doing the multiple different types, then I think a hierarchical structure like that would be good.

@jerzykrlk
Copy link
Contributor Author

Sure, here's another pull request: #854

@jerzykrlk jerzykrlk deleted the fine-grained-exceptions branch May 28, 2019 18:35
velo pushed a commit that referenced this pull request Oct 7, 2024
velo pushed a commit that referenced this pull request Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement For recommending new capabilities waiting for votes Enhancements or changes proposed that need more support before consideration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants