Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1786156: Replace raw asserts with exceptions #1953

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -925,11 +925,13 @@ private void parseCommand() throws SnowflakeSQLException {

// get source file locations as array (apply to both upload and download)
JsonNode locationsNode = jsonNode.path("data").path("src_locations");
if (!locationsNode.isArray()) {
throw new SnowflakeSQLException(
queryID, ErrorCode.INTERNAL_ERROR, "src_locations must be an array");
}

queryID = jsonNode.path("data").path("queryId").asText();

assert locationsNode.isArray();

String[] src_locations;

try {
Expand Down Expand Up @@ -1459,7 +1461,13 @@ public static List<SnowflakeFileTransferMetadata> getFileTransferMetadatas(
}

// For UPLOAD we expect encryptionMaterial to have length 1
assert encryptionMaterial.size() == 1;
if (encryptionMaterial.size() != 1) {
throw new SnowflakeSQLException(
queryId,
ErrorCode.INTERNAL_ERROR,
"Encryption material for UPLOAD should have size 1 but have "
+ encryptionMaterial.size());
}

final Set<String> sourceFiles = expandFileNames(srcLocations, queryId);

Expand Down
Loading