Skip to content

Commit e6fec73

Browse files
update logging for checksum calculation failures
1 parent 0339253 commit e6fec73

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

source/s3_checksum_stream.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,19 @@ static int s_finalize_checksum(struct aws_checksum_stream *impl) {
3535
return aws_raise_error(AWS_ERROR_S3_CHECKSUM_CALCULATION_FAILED);
3636
}
3737
struct aws_byte_cursor checksum_result_cursor = aws_byte_cursor_from_buf(&impl->checksum_result);
38-
AWS_FATAL_ASSERT(aws_base64_encode(&checksum_result_cursor, impl->encoded_checksum_output) == AWS_OP_SUCCESS);
38+
if (aws_base64_encode(&checksum_result_cursor, impl->encoded_checksum_output) != AWS_OP_SUCCESS) {
39+
AWS_LOGF_ERROR(
40+
AWS_LS_S3_CLIENT,
41+
"Failed to base64 encode checksum with error code %d (%s). Output capacity: %zu length %zu",
42+
aws_last_error(),
43+
aws_error_str(aws_last_error()),
44+
impl->encoded_checksum_output->capacity,
45+
impl->encoded_checksum_output->len);
46+
aws_byte_buf_reset(&impl->checksum_result, true);
47+
impl->checksum_finalized = true;
48+
return aws_raise_error(AWS_ERROR_S3_CHECKSUM_CALCULATION_FAILED);
49+
}
50+
3951
impl->checksum_finalized = true;
4052
return AWS_OP_SUCCESS;
4153
}

0 commit comments

Comments
 (0)