Skip to content

Cherrypick for RELEASE-11: Passing actual response status code in error-handler #1583

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public boolean isSuccess() {
*/
public KubernetesApiResponse<DataType> throwsApiException() throws ApiException {
return onFailure(
errorStatus -> {
throw new ApiException(errorStatus.toString());
(code, errorStatus) -> {
throw new ApiException(code, errorStatus.toString());
});
}

Expand All @@ -74,12 +74,12 @@ public KubernetesApiResponse<DataType> throwsApiException() throws ApiException
public KubernetesApiResponse<DataType> onFailure(ErrorStatusHandler errorStatusHandler)
throws ApiException {
if (!isSuccess()) {
errorStatusHandler.handle(this.status);
errorStatusHandler.handle(this.getHttpStatusCode(), this.status);
}
return this;
}

public interface ErrorStatusHandler {
void handle(V1Status errorStatus) throws ApiException;
void handle(int code, V1Status errorStatus) throws ApiException;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void testErrorStatusHandler() throws ApiException {
podClient
.delete("default", "foo")
.onFailure(
errStatus -> {
(code, errStatus) -> {
catched.set(true);
})
.getObject());
Expand Down