Skip to content

Commit

Permalink
SNOW-1786156: Replace raw asserts with exceptions (#1953)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-dprzybysz authored Nov 5, 2024
1 parent e28c15e commit fd0ddd5
Showing 1 changed file with 11 additions and 3 deletions.
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

0 comments on commit fd0ddd5

Please sign in to comment.