Skip to content

Commit 7884b66

Browse files
committed
Throw exception when getting token fails
1 parent 2a4b4ba commit 7884b66

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/java/com/aspose/barcode/cloud/ApiClient.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,9 @@ public void requestToken() throws ApiException {
955955
.build();
956956

957957
Response response = httpClient.newCall(request).execute();
958+
if (response.code() != 200) {
959+
throw new ApiException("Error fetching token: " + response.message(), response.code());
960+
}
958961
GetAccessTokenResult result =
959962
json.deserialize(response.body().string(), GetAccessTokenResult.class);
960963
setAccessToken(result.access_token);

0 commit comments

Comments
 (0)