Skip to content

Commit

Permalink
Use readBodyBytes for correct exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-signal authored and greyson-signal committed Apr 21, 2020
1 parent 8e13403 commit e2d3a43
Showing 1 changed file with 7 additions and 7 deletions.
Expand Up @@ -828,7 +828,7 @@ public StorageManifest getStorageManifest(String authToken) throws IOException {
throw new IOException("Missing body!");
}

return StorageManifest.parseFrom(response.bytes());
return StorageManifest.parseFrom(readBodyBytes(response));
}

public StorageManifest getStorageManifestIfDifferentVersion(String authToken, long version) throws IOException {
Expand All @@ -838,7 +838,7 @@ public StorageManifest getStorageManifestIfDifferentVersion(String authToken, lo
throw new IOException("Missing body!");
}

return StorageManifest.parseFrom(response.bytes());
return StorageManifest.parseFrom(readBodyBytes(response));
}

public StorageItems readStorageItems(String authToken, ReadOperation operation) throws IOException {
Expand All @@ -848,7 +848,7 @@ public StorageItems readStorageItems(String authToken, ReadOperation operation)
throw new IOException("Missing body!");
}

return StorageItems.parseFrom(response.bytes());
return StorageItems.parseFrom(readBodyBytes(response));
}

public Optional<StorageManifest> writeStorageContacts(String authToken, WriteOperation writeOperation) throws IOException {
Expand Down Expand Up @@ -1733,7 +1733,7 @@ public Group getGroupsV2Group(String authorization)
null);

try {
return Group.parseFrom(response.bytes());
return Group.parseFrom(readBodyBytes(response));
} catch (InvalidProtocolBufferException e) {
throw new IOException("Cannot read protobuf", e);
}
Expand All @@ -1748,7 +1748,7 @@ public AvatarUploadAttributes getGroupsV2AvatarUploadForm(String authorization)
null);

try {
return AvatarUploadAttributes.parseFrom(response.bytes());
return AvatarUploadAttributes.parseFrom(readBodyBytes(response));
} catch (InvalidProtocolBufferException e) {
throw new IOException("Cannot read protobuf", e);
}
Expand All @@ -1763,7 +1763,7 @@ public GroupChange patchGroupsV2Group(GroupChange.Actions groupChange, String au
protobufRequestBody(groupChange));

try {
return GroupChange.parseFrom(response.bytes());
return GroupChange.parseFrom(readBodyBytes(response));
} catch (InvalidProtocolBufferException e) {
throw new IOException("Cannot read protobuf", e);
}
Expand All @@ -1778,7 +1778,7 @@ public GroupChanges getGroupsV2GroupHistory(int fromVersion, String authorizatio
null);

try {
return GroupChanges.parseFrom(response.bytes());
return GroupChanges.parseFrom(readBodyBytes(response));
} catch (InvalidProtocolBufferException e) {
throw new IOException("Cannot read protobuf", e);
}
Expand Down

0 comments on commit e2d3a43

Please sign in to comment.