Skip to content

Commit 12e1b24

Browse files
committed
Updated sources
1 parent d664fb7 commit 12e1b24

File tree

4 files changed

+30
-10
lines changed

4 files changed

+30
-10
lines changed

src/main/java/com/groupdocs/cloud/conversion/client/ApiClient.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -868,15 +868,25 @@ public <T> T handleResponse(Response response, Type returnType) throws ApiExcept
868868
throw new ApiException(response.message(), response.code());
869869
}
870870

871-
ApiError apiError = null;
871+
com.groupdocs.cloud.conversion.model.Error Error = null;
872872
try {
873-
apiError = json.deserialize(respBody, ApiError.class);
873+
Error = json.deserialize(respBody, com.groupdocs.cloud.conversion.model.Error.class);
874874
} catch (Exception e) {
875875
//NOTE: ignore
876876
}
877-
if(apiError != null && apiError.getError() != null) {
878-
throw new ApiException(apiError.getError().getMessage(), response.code());
877+
if(Error != null && Error.getCode() != null) {
878+
throw new ApiException(Error.getMessage(), response.code());
879879
}
880+
881+
com.groupdocs.cloud.conversion.model.ApiError apiError = null;
882+
try {
883+
apiError = json.deserialize(respBody, com.groupdocs.cloud.conversion.model.ApiError.class);
884+
} catch (Exception e) {
885+
//NOTE: ignore
886+
}
887+
if(apiError != null && apiError.getError().getCode() != null) {
888+
throw new ApiException(apiError.getError().getMessage(), response.code());
889+
}
880890

881891
AuthError authError = null;
882892
try {

src/main/java/com/groupdocs/cloud/conversion/model/ApiError.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
*/
4040
@ApiModel(description = "Describes API error.")
4141
public class ApiError {
42-
@SerializedName("Error")
42+
@SerializedName("error")
4343
private Error error = null;
4444

4545
public ApiError error(Error error) {

src/main/java/com/groupdocs/cloud/conversion/model/Error.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
*/
4040
@ApiModel(description = "Describes API error.")
4141
public class Error {
42-
@SerializedName("Code")
42+
@SerializedName("code")
4343
private String code = null;
4444

4545
public Error code(String code) {
@@ -60,7 +60,7 @@ public void setCode(String code) {
6060
this.code = code;
6161
}
6262

63-
@SerializedName("Message")
63+
@SerializedName("message")
6464
private String message = null;
6565

6666
public Error message(String message) {

src/test/java/com/groupdocs/cloud/conversion/api/InfoApiTests.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727

2828
package com.groupdocs.cloud.conversion.api;
2929

30-
import static org.junit.Assert.assertFalse;
31-
import static org.junit.Assert.assertTrue;
30+
import static org.junit.Assert.*;
3231

3332
import java.util.List;
3433

@@ -72,4 +71,15 @@ public void getDocumentMetadataTest() throws ApiException {
7271

7372
assertTrue(4 == response.getPageCount());
7473
}
75-
}
74+
75+
@Test
76+
public void getInfoReturnsFileNotFoundTest()
77+
{
78+
try {
79+
infoApi.getDocumentMetadata(new GetDocumentMetadataRequest(TestFiles.NotExist.getPath(), ""));
80+
fail("Expected ApiException was not thrown.");
81+
} catch (ApiException ex) {
82+
assertTrue(ex.getMessage().contains("AmazonS3 Storage exception: The specified key does not exist"));
83+
}
84+
}
85+
}

0 commit comments

Comments
 (0)