Add ability to not throw exception when http status code > 399
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.8k
- Forks
- 1.9k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 41
Description
Currently our team convention is to use response status instead of throwing exception. Say our model is like this:
public class BaseResponse {
private String message;
private int httpStatusCode;
private Boolean isFailed;
private int errorCode;
}
So when our API endpoint failed, we return BaseResponse with failed status instead. Now this is not possible to be read by the client using openfeign since feign will throw exception directly if >399 response status retrieved, so our returned response is useless. We can make our api to return 200 status code instead, but that would violate RESTFUL.
Understand that openfeign is designed to be strictly RESTFUL, but I don't think forcing your user to throw exception is the right thing, because different teams have different convention used on how they handle the failure, and in our case we use our response entity that would describe the failure status.
I appreciate if this feature can be considered, and I will be happy to contribute if needed. Thank you.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how OpenFeign handles responses with HTTP status codes above 399 and where the exception is created. Determine how a caller could opt out of that behavior while still reading the returned response. Done means a documented, usable option exists for clients that handle failures through their response entity, with coverage for status codes above 399.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100