Skip to content

Commit 5823739

Browse files
committed
passing actual response status code in error-handler
1 parent 70259f3 commit 5823739

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

util/src/main/java/io/kubernetes/client/util/generic/KubernetesApiResponse.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ public boolean isSuccess() {
5959
*/
6060
public KubernetesApiResponse<DataType> throwsApiException() throws ApiException {
6161
return onFailure(
62-
errorStatus -> {
63-
throw new ApiException(errorStatus.toString());
62+
(code, errorStatus) -> {
63+
throw new ApiException(code, errorStatus.toString());
6464
});
6565
}
6666

@@ -74,12 +74,12 @@ public KubernetesApiResponse<DataType> throwsApiException() throws ApiException
7474
public KubernetesApiResponse<DataType> onFailure(ErrorStatusHandler errorStatusHandler)
7575
throws ApiException {
7676
if (!isSuccess()) {
77-
errorStatusHandler.handle(this.status);
77+
errorStatusHandler.handle(this.getHttpStatusCode(), this.status);
7878
}
7979
return this;
8080
}
8181

8282
public interface ErrorStatusHandler {
83-
void handle(V1Status errorStatus) throws ApiException;
83+
void handle(int code, V1Status errorStatus) throws ApiException;
8484
}
8585
}

0 commit comments

Comments
 (0)