Skip to content

Add ability to not throw exception when http status code > 399 #2944

@ihsansfd

Description

@ihsansfd

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions