Skip to content

Commit

Permalink
fix(ApiRepoExHandler): fix incorrect logic for error code handling
Browse files Browse the repository at this point in the history
  • Loading branch information
vincejv committed Nov 12, 2022
1 parent 23b341e commit bc8a0f2
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ public ApiSvcEx toThrowable(Response response) {
// exception is ignored
}

if (response.getStatus() != RestResponse.StatusCode.UNAUTHORIZED ||
response.getStatus() != RestResponse.StatusCode.FORBIDDEN) {
return new ApiSvcEx("Rest Client encountered an exception!", response.getStatus(), getBody(response),
if (response.getStatus() == RestResponse.StatusCode.UNAUTHORIZED ||
response.getStatus() == RestResponse.StatusCode.FORBIDDEN) {
return new AuthApiSvcEx("Rest Client was unable to access the resource!", response.getStatus(), getBody(response),
String.valueOf(response.getLocation()),
response.getStringHeaders().entrySet().stream().collect(Collectors.toUnmodifiableMap(
Map.Entry::getKey, e -> StringUtils.join(e.getValue(), FWConst.COMMA_SEP)
)));
} else {
return new AuthApiSvcEx("Rest Client was unable to access the resource!", response.getStatus(), getBody(response),
return new ApiSvcEx("Rest Client encountered an exception!", response.getStatus(), getBody(response),
String.valueOf(response.getLocation()),
response.getStringHeaders().entrySet().stream().collect(Collectors.toUnmodifiableMap(
Map.Entry::getKey, e -> StringUtils.join(e.getValue(), FWConst.COMMA_SEP)
Expand Down

0 comments on commit bc8a0f2

Please sign in to comment.