unify message format of exception/assertion (#2382)
* unify exception message * unify format of assertion message
This commit is contained in:
parent
af52a49bbe
commit
1b132190ee
@ -258,14 +258,14 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
if (static_cast<size_t>(blobRangeSize) > bufferSize)
|
||||
{
|
||||
throw Azure::Core::RequestFailedException(
|
||||
"buffer is not big enough, blob range size is " + std::to_string(blobRangeSize));
|
||||
"Buffer is not big enough, blob range size is " + std::to_string(blobRangeSize) + ".");
|
||||
}
|
||||
|
||||
int64_t bytesRead = firstChunk.Value.BodyStream->ReadToCount(
|
||||
buffer, static_cast<size_t>(firstChunkLength), context);
|
||||
if (bytesRead != firstChunkLength)
|
||||
{
|
||||
throw Azure::Core::RequestFailedException("error when reading body stream");
|
||||
throw Azure::Core::RequestFailedException("Error when reading body stream.");
|
||||
}
|
||||
firstChunk.Value.BodyStream.reset();
|
||||
|
||||
@ -296,7 +296,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
context);
|
||||
if (bytesRead != chunkOptions.Range.Value().Length.Value())
|
||||
{
|
||||
throw Azure::Core::RequestFailedException("error when reading body stream");
|
||||
throw Azure::Core::RequestFailedException("Error when reading body stream.");
|
||||
}
|
||||
|
||||
if (chunkId == numChunks - 1)
|
||||
@ -376,7 +376,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
size_t bytesRead = stream.ReadToCount(buffer.data(), readSize, context);
|
||||
if (bytesRead != readSize)
|
||||
{
|
||||
throw Azure::Core::RequestFailedException("error when reading body stream");
|
||||
throw Azure::Core::RequestFailedException("Error when reading body stream.");
|
||||
}
|
||||
fileWriter.Write(buffer.data(), bytesRead, offset);
|
||||
length -= bytesRead;
|
||||
|
||||
@ -55,13 +55,13 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
|
||||
AZURE_ASSERT_MSG(
|
||||
!options.AccessConditions.IfMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-Match condition");
|
||||
"Blob container lease doesn't support If-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
!options.AccessConditions.IfNoneMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-None-Match condition");
|
||||
"Blob container lease doesn't support If-None-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
!options.AccessConditions.TagConditions.HasValue(),
|
||||
"Blob container lease doesn't support tag condition");
|
||||
"Blob container lease doesn't support tag condition.");
|
||||
|
||||
auto response = _detail::BlobRestClient::BlobContainer::AcquireLease(
|
||||
*(m_blobContainerClient.Value().m_pipeline),
|
||||
@ -120,13 +120,13 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
|
||||
AZURE_ASSERT_MSG(
|
||||
!options.AccessConditions.IfMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-Match condition");
|
||||
"Blob container lease doesn't support If-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
!options.AccessConditions.IfNoneMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-None-Match condition");
|
||||
"Blob container lease doesn't support If-None-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
!options.AccessConditions.TagConditions.HasValue(),
|
||||
"Blob container lease doesn't support tag condition");
|
||||
"Blob container lease doesn't support tag condition.");
|
||||
|
||||
auto response = _detail::BlobRestClient::BlobContainer::RenewLease(
|
||||
*(m_blobContainerClient.Value().m_pipeline),
|
||||
@ -184,13 +184,13 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
|
||||
AZURE_ASSERT_MSG(
|
||||
!options.AccessConditions.IfMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-Match condition");
|
||||
"Blob container lease doesn't support If-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
!options.AccessConditions.IfNoneMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-None-Match condition");
|
||||
"Blob container lease doesn't support If-None-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
!options.AccessConditions.TagConditions.HasValue(),
|
||||
"Blob container lease doesn't support tag condition");
|
||||
"Blob container lease doesn't support tag condition.");
|
||||
|
||||
auto response = _detail::BlobRestClient::BlobContainer::ReleaseLease(
|
||||
*(m_blobContainerClient.Value().m_pipeline),
|
||||
@ -256,13 +256,13 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
|
||||
AZURE_ASSERT_MSG(
|
||||
!options.AccessConditions.IfMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-Match condition");
|
||||
"Blob container lease doesn't support If-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
!options.AccessConditions.IfNoneMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-None-Match condition");
|
||||
"Blob container lease doesn't support If-None-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
!options.AccessConditions.TagConditions.HasValue(),
|
||||
"Blob container lease doesn't support tag condition");
|
||||
"Blob container lease doesn't support tag condition.");
|
||||
|
||||
auto response = _detail::BlobRestClient::BlobContainer::ChangeLease(
|
||||
*(m_blobContainerClient.Value().m_pipeline),
|
||||
@ -325,13 +325,13 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
|
||||
AZURE_ASSERT_MSG(
|
||||
!options.AccessConditions.IfMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-Match condition");
|
||||
"Blob container lease doesn't support If-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
!options.AccessConditions.IfNoneMatch.HasValue(),
|
||||
"Blob container lease doesn't support If-None-Match condition");
|
||||
"Blob container lease doesn't support If-None-Match condition.");
|
||||
AZURE_ASSERT_MSG(
|
||||
!options.AccessConditions.TagConditions.HasValue(),
|
||||
"Blob container lease doesn't support tag condition");
|
||||
"Blob container lease doesn't support tag condition.");
|
||||
|
||||
auto response = _detail::BlobRestClient::BlobContainer::BreakLease(
|
||||
*(m_blobContainerClient.Value().m_pipeline),
|
||||
|
||||
@ -50,11 +50,11 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
else if (m_status == Azure::Core::OperationStatus::Failed)
|
||||
{
|
||||
throw Azure::Core::RequestFailedException("Operation failed");
|
||||
throw Azure::Core::RequestFailedException("Operation failed.");
|
||||
}
|
||||
else if (m_status == Azure::Core::OperationStatus::Cancelled)
|
||||
{
|
||||
throw Azure::Core::RequestFailedException("Operation was cancelled");
|
||||
throw Azure::Core::RequestFailedException("Operation was cancelled.");
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(period);
|
||||
|
||||
@ -29,7 +29,7 @@ namespace Azure { namespace Storage { namespace Sas {
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::invalid_argument("unknown BlobSasResource value");
|
||||
throw std::invalid_argument("Unknown BlobSasResource value.");
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@ -150,7 +150,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
if (chunkSize > MaxStageBlockSize)
|
||||
{
|
||||
throw Azure::Core::RequestFailedException("Block size is too big");
|
||||
throw Azure::Core::RequestFailedException("Block size is too big.");
|
||||
}
|
||||
|
||||
std::vector<std::string> blockIds;
|
||||
@ -256,7 +256,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
if (chunkSize > MaxStageBlockSize)
|
||||
{
|
||||
throw Azure::Core::RequestFailedException("Block size is too big");
|
||||
throw Azure::Core::RequestFailedException("Block size is too big.");
|
||||
}
|
||||
|
||||
_internal::ConcurrentTransfer(
|
||||
|
||||
@ -26,7 +26,7 @@ std::string GetConnectionString()
|
||||
{
|
||||
return envConnectionString;
|
||||
}
|
||||
throw std::runtime_error("Cannot find connection string");
|
||||
throw std::runtime_error("Cannot find connection string.");
|
||||
}
|
||||
|
||||
std::string GetAccountName()
|
||||
|
||||
@ -103,7 +103,7 @@ namespace Azure { namespace Storage {
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("unknown algorithm type");
|
||||
throw std::runtime_error("Unknown algorithm type.");
|
||||
}
|
||||
|
||||
unsigned long algorithmFlags = 0;
|
||||
@ -115,7 +115,7 @@ namespace Azure { namespace Storage {
|
||||
= BCryptOpenAlgorithmProvider(&Handle, algorithmId, nullptr, algorithmFlags);
|
||||
if (!BCRYPT_SUCCESS(status))
|
||||
{
|
||||
throw std::runtime_error("BCryptOpenAlgorithmProvider failed");
|
||||
throw std::runtime_error("BCryptOpenAlgorithmProvider failed.");
|
||||
}
|
||||
DWORD objectLength = 0;
|
||||
DWORD dataLength = 0;
|
||||
@ -128,7 +128,7 @@ namespace Azure { namespace Storage {
|
||||
0);
|
||||
if (!BCRYPT_SUCCESS(status))
|
||||
{
|
||||
throw std::runtime_error("BCryptGetProperty failed");
|
||||
throw std::runtime_error("BCryptGetProperty failed.");
|
||||
}
|
||||
ContextSize = objectLength;
|
||||
DWORD hashLength = 0;
|
||||
@ -141,7 +141,7 @@ namespace Azure { namespace Storage {
|
||||
0);
|
||||
if (!BCRYPT_SUCCESS(status))
|
||||
{
|
||||
throw std::runtime_error("BCryptGetProperty failed");
|
||||
throw std::runtime_error("BCryptGetProperty failed.");
|
||||
}
|
||||
HashLength = hashLength;
|
||||
}
|
||||
@ -167,7 +167,7 @@ namespace Azure { namespace Storage {
|
||||
0);
|
||||
if (!BCRYPT_SUCCESS(status))
|
||||
{
|
||||
throw std::runtime_error("BCryptCreateHash failed");
|
||||
throw std::runtime_error("BCryptCreateHash failed.");
|
||||
}
|
||||
|
||||
status = BCryptHashData(
|
||||
@ -177,7 +177,7 @@ namespace Azure { namespace Storage {
|
||||
0);
|
||||
if (!BCRYPT_SUCCESS(status))
|
||||
{
|
||||
throw std::runtime_error("BCryptHashData failed");
|
||||
throw std::runtime_error("BCryptHashData failed.");
|
||||
}
|
||||
|
||||
std::vector<uint8_t> hash;
|
||||
@ -186,7 +186,7 @@ namespace Azure { namespace Storage {
|
||||
hashHandle, reinterpret_cast<PUCHAR>(&hash[0]), static_cast<ULONG>(hash.size()), 0);
|
||||
if (!BCRYPT_SUCCESS(status))
|
||||
{
|
||||
throw std::runtime_error("BCryptFinishHash failed");
|
||||
throw std::runtime_error("BCryptFinishHash failed.");
|
||||
}
|
||||
|
||||
BCryptDestroyHash(hashHandle);
|
||||
@ -215,7 +215,7 @@ namespace Azure { namespace Storage {
|
||||
0);
|
||||
if (!BCRYPT_SUCCESS(status))
|
||||
{
|
||||
throw std::runtime_error("BCryptCreateHash failed");
|
||||
throw std::runtime_error("BCryptCreateHash failed.");
|
||||
}
|
||||
|
||||
status = BCryptHashData(
|
||||
@ -225,7 +225,7 @@ namespace Azure { namespace Storage {
|
||||
0);
|
||||
if (!BCRYPT_SUCCESS(status))
|
||||
{
|
||||
throw std::runtime_error("BCryptHashData failed");
|
||||
throw std::runtime_error("BCryptHashData failed.");
|
||||
}
|
||||
|
||||
std::vector<uint8_t> hash;
|
||||
@ -234,7 +234,7 @@ namespace Azure { namespace Storage {
|
||||
hashHandle, reinterpret_cast<PUCHAR>(&hash[0]), static_cast<ULONG>(hash.size()), 0);
|
||||
if (!BCRYPT_SUCCESS(status))
|
||||
{
|
||||
throw std::runtime_error("BCryptFinishHash failed");
|
||||
throw std::runtime_error("BCryptFinishHash failed.");
|
||||
}
|
||||
|
||||
BCryptDestroyHash(hashHandle);
|
||||
|
||||
@ -34,7 +34,7 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
CP_UTF8, MB_ERR_INVALID_CHARS, filename.data(), int(filename.length()), nullptr, 0);
|
||||
if (sizeNeeded == 0)
|
||||
{
|
||||
throw std::runtime_error("invalid filename");
|
||||
throw std::runtime_error("Invalid filename.");
|
||||
}
|
||||
std::wstring filenameW(sizeNeeded, L'\0');
|
||||
if (MultiByteToWideChar(
|
||||
@ -46,7 +46,7 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
sizeNeeded)
|
||||
== 0)
|
||||
{
|
||||
throw std::runtime_error("invalid filename");
|
||||
throw std::runtime_error("Invalid filename.");
|
||||
}
|
||||
|
||||
HANDLE fileHandle;
|
||||
@ -66,7 +66,7 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
#endif
|
||||
if (fileHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
throw std::runtime_error("failed to open file");
|
||||
throw std::runtime_error("Failed to open file.");
|
||||
}
|
||||
|
||||
LARGE_INTEGER fileSize;
|
||||
@ -74,7 +74,7 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
if (!ret)
|
||||
{
|
||||
CloseHandle(fileHandle);
|
||||
throw std::runtime_error("failed to get size of file");
|
||||
throw std::runtime_error("Failed to get size of file.");
|
||||
}
|
||||
m_handle = static_cast<void*>(fileHandle);
|
||||
m_fileSize = fileSize.QuadPart;
|
||||
@ -88,7 +88,7 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
CP_UTF8, MB_ERR_INVALID_CHARS, filename.data(), int(filename.length()), nullptr, 0);
|
||||
if (sizeNeeded == 0)
|
||||
{
|
||||
throw std::runtime_error("invalid filename");
|
||||
throw std::runtime_error("Invalid filename.");
|
||||
}
|
||||
std::wstring filenameW(sizeNeeded, L'\0');
|
||||
if (MultiByteToWideChar(
|
||||
@ -100,7 +100,7 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
sizeNeeded)
|
||||
== 0)
|
||||
{
|
||||
throw std::runtime_error("invalid filename");
|
||||
throw std::runtime_error("Invalid filename.");
|
||||
}
|
||||
|
||||
HANDLE fileHandle;
|
||||
@ -121,7 +121,7 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
#endif
|
||||
if (fileHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
throw std::runtime_error("failed to open file");
|
||||
throw std::runtime_error("Failed to open file.");
|
||||
}
|
||||
m_handle = static_cast<void*>(fileHandle);
|
||||
}
|
||||
@ -132,7 +132,7 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
{
|
||||
if (length > std::numeric_limits<DWORD>::max())
|
||||
{
|
||||
throw std::runtime_error("failed to write file");
|
||||
throw std::runtime_error("Failed to write file.");
|
||||
}
|
||||
|
||||
OVERLAPPED overlapped;
|
||||
@ -149,7 +149,7 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
&overlapped);
|
||||
if (!ret)
|
||||
{
|
||||
throw std::runtime_error("failed to write file");
|
||||
throw std::runtime_error("Failed to write file.");
|
||||
}
|
||||
}
|
||||
#elif defined(AZ_PLATFORM_POSIX)
|
||||
@ -158,13 +158,13 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
m_handle = open(filename.data(), O_RDONLY);
|
||||
if (m_handle == -1)
|
||||
{
|
||||
throw std::runtime_error("failed to open file");
|
||||
throw std::runtime_error("Failed to open file.");
|
||||
}
|
||||
m_fileSize = lseek(m_handle, 0, SEEK_END);
|
||||
if (m_fileSize == -1)
|
||||
{
|
||||
close(m_handle);
|
||||
throw std::runtime_error("failed to get size of file");
|
||||
throw std::runtime_error("Failed to get size of file.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
filename.data(), O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
if (m_handle == -1)
|
||||
{
|
||||
throw std::runtime_error("failed to open file");
|
||||
throw std::runtime_error("Failed to open file.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,12 +186,12 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
{
|
||||
if (offset > static_cast<int64_t>(std::numeric_limits<off_t>::max()))
|
||||
{
|
||||
throw std::runtime_error("failed to write file");
|
||||
throw std::runtime_error("Failed to write file.");
|
||||
}
|
||||
ssize_t bytesWritten = pwrite(m_handle, buffer, length, static_cast<off_t>(offset));
|
||||
if (bytesWritten < 0 || static_cast<size_t>(bytesWritten) != length)
|
||||
{
|
||||
throw std::runtime_error("failed to write file");
|
||||
throw std::runtime_error("Failed to write file.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -89,7 +89,7 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
{
|
||||
if (accountName.empty())
|
||||
{
|
||||
throw std::runtime_error("Cannot find account name in connection string");
|
||||
throw std::runtime_error("Cannot find account name in connection string.");
|
||||
}
|
||||
connectionStringParts.KeyCredential
|
||||
= std::make_shared<StorageSharedKeyCredential>(accountName, accountKey);
|
||||
|
||||
@ -25,13 +25,13 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
|
||||
if (length > static_cast<size_t>(std::numeric_limits<int>::max()))
|
||||
{
|
||||
throw std::runtime_error("xml data too big");
|
||||
throw std::runtime_error("Xml data too big.");
|
||||
}
|
||||
|
||||
m_reader = xmlReaderForMemory(data, static_cast<int>(length), nullptr, nullptr, 0);
|
||||
if (!m_reader)
|
||||
{
|
||||
throw std::runtime_error("failed to parse xml");
|
||||
throw std::runtime_error("Failed to parse xml.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("failed to parse xml");
|
||||
throw std::runtime_error("Failed to parse xml.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
}
|
||||
if (ret != 1)
|
||||
{
|
||||
throw std::runtime_error("failed to parse xml");
|
||||
throw std::runtime_error("Failed to parse xml.");
|
||||
}
|
||||
|
||||
int type = xmlTextReaderNodeType(reader);
|
||||
@ -107,7 +107,7 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("unknown type " + std::to_string(type) + " while parsing xml");
|
||||
throw std::runtime_error("Unknown type " + std::to_string(type) + " while parsing xml.");
|
||||
}
|
||||
|
||||
return Read();
|
||||
@ -172,8 +172,8 @@ namespace Azure { namespace Storage { namespace _internal {
|
||||
else
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"unsupported XmlNode type "
|
||||
+ std::to_string(static_cast<std::underlying_type<XmlNodeType>::type>(node.Type)));
|
||||
"Unsupported XmlNode type "
|
||||
+ std::to_string(static_cast<std::underlying_type<XmlNodeType>::type>(node.Type)) + ".");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -246,7 +246,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
FILE* fin = fopen(filename.data(), "rb");
|
||||
if (!fin)
|
||||
{
|
||||
throw std::runtime_error("failed to open file");
|
||||
throw std::runtime_error("Failed to open file.");
|
||||
}
|
||||
fseek(fin, 0, SEEK_END);
|
||||
int64_t fileSize = ftell(fin);
|
||||
@ -255,7 +255,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
size_t elementsRead = fread(fileContent.data(), static_cast<size_t>(fileSize), 1, fin);
|
||||
if (elementsRead != 1 && fileSize != 0)
|
||||
{
|
||||
throw std::runtime_error("failed to read file");
|
||||
throw std::runtime_error("Failed to read file.");
|
||||
}
|
||||
fclose(fin);
|
||||
return fileContent;
|
||||
|
||||
@ -379,7 +379,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
protocolLayerOptions.ExpiryOrigin = expiryOrigin;
|
||||
AZURE_ASSERT_MSG(
|
||||
!(options.ExpiresOn.HasValue() && options.TimeToExpire.HasValue()),
|
||||
"ExpiresOn and TimeToExpire are mutually exclusive");
|
||||
"ExpiresOn and TimeToExpire are mutually exclusive.");
|
||||
|
||||
if (options.ExpiresOn.HasValue())
|
||||
{
|
||||
|
||||
@ -24,7 +24,7 @@ namespace Azure { namespace Storage { namespace Sas {
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::invalid_argument("unknown DataLakeSasResource value");
|
||||
throw std::invalid_argument("Unknown DataLakeSasResource value.");
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@ -168,7 +168,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
options.HttpHeaders.ContentHash.Algorithm == HashAlgorithm::Md5,
|
||||
"This operation only supports MD5 content hash");
|
||||
"This operation only supports MD5 content hash.");
|
||||
protocolLayerOptions.ContentMd5 = options.HttpHeaders.ContentHash;
|
||||
}
|
||||
protocolLayerOptions.LeaseIdOptional = options.AccessConditions.LeaseId;
|
||||
@ -242,7 +242,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
options.RangeHashAlgorithm.Value() == HashAlgorithm::Md5,
|
||||
"This operation only supports MD5 content hash");
|
||||
"This operation only supports MD5 content hash.");
|
||||
if (options.RangeHashAlgorithm.Value() == HashAlgorithm::Md5)
|
||||
{
|
||||
protocolLayerOptions.GetRangeContentMd5 = true;
|
||||
@ -272,7 +272,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
auto newResponse = Download(newOptions, context);
|
||||
if (eTag != newResponse.Value.Details.ETag)
|
||||
{
|
||||
throw Azure::Core::RequestFailedException("file was modified in the middle of download");
|
||||
throw Azure::Core::RequestFailedException("File was modified in the middle of download.");
|
||||
}
|
||||
return std::move(newResponse.Value.BodyStream);
|
||||
};
|
||||
@ -350,7 +350,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
}
|
||||
else
|
||||
{
|
||||
AZURE_ASSERT_MSG(false, "Either FilePermission or FilePermissionKey must be set");
|
||||
AZURE_ASSERT_MSG(false, "Either FilePermission or FilePermissionKey must be set.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -489,7 +489,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Md5,
|
||||
"This operation only supports MD5 content hash");
|
||||
"This operation only supports MD5 content hash.");
|
||||
}
|
||||
protocolLayerOptions.ContentMd5 = options.TransactionalContentHash;
|
||||
protocolLayerOptions.LeaseIdOptional = options.AccessConditions.LeaseId;
|
||||
@ -691,14 +691,14 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
if (static_cast<size_t>(fileRangeSize) > bufferSize)
|
||||
{
|
||||
throw Azure::Core::RequestFailedException(
|
||||
"buffer is not big enough, file range size is " + std::to_string(fileRangeSize));
|
||||
"Buffer is not big enough, file range size is " + std::to_string(fileRangeSize) + ".");
|
||||
}
|
||||
|
||||
int64_t bytesRead = firstChunk.Value.BodyStream->ReadToCount(
|
||||
buffer, static_cast<size_t>(firstChunkLength), context);
|
||||
if (bytesRead != firstChunkLength)
|
||||
{
|
||||
throw Azure::Core::RequestFailedException("error when reading body stream");
|
||||
throw Azure::Core::RequestFailedException("Error when reading body stream.");
|
||||
}
|
||||
firstChunk.Value.BodyStream.reset();
|
||||
|
||||
@ -726,12 +726,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
context);
|
||||
if (bytesRead != chunkOptions.Range.Value().Length.Value())
|
||||
{
|
||||
throw Azure::Core::RequestFailedException("error when reading body stream");
|
||||
throw Azure::Core::RequestFailedException("Error when reading body stream.");
|
||||
}
|
||||
if (chunk.Value.Details.ETag != etag)
|
||||
{
|
||||
throw Azure::Core::RequestFailedException(
|
||||
"file was modified in the middle of download");
|
||||
"File was modified in the middle of download.");
|
||||
}
|
||||
|
||||
if (chunkId == numChunks - 1)
|
||||
@ -812,7 +812,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
size_t bytesRead = stream.ReadToCount(buffer.data(), readSize, context);
|
||||
if (bytesRead != readSize)
|
||||
{
|
||||
throw Azure::Core::RequestFailedException("error when reading body stream");
|
||||
throw Azure::Core::RequestFailedException("Error when reading body stream.");
|
||||
}
|
||||
fileWriter.Write(buffer.data(), bytesRead, offset);
|
||||
length -= bytesRead;
|
||||
@ -849,7 +849,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
if (chunk.Value.Details.ETag != etag)
|
||||
{
|
||||
throw Azure::Core::RequestFailedException(
|
||||
"file was modified in the middle of download");
|
||||
"File was modified in the middle of download.");
|
||||
}
|
||||
bodyStreamToFile(
|
||||
*(chunk.Value.BodyStream),
|
||||
@ -946,7 +946,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
options.HttpHeaders.ContentHash.Algorithm == HashAlgorithm::Md5,
|
||||
"This operation only supports MD5 content hash");
|
||||
"This operation only supports MD5 content hash.");
|
||||
protocolLayerOptions.ContentMd5 = options.HttpHeaders.ContentHash;
|
||||
}
|
||||
protocolLayerOptions.Metadata = options.Metadata;
|
||||
@ -1050,7 +1050,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
options.HttpHeaders.ContentHash.Algorithm == HashAlgorithm::Md5,
|
||||
"This operation only supports MD5 content hash");
|
||||
"This operation only supports MD5 content hash.");
|
||||
protocolLayerOptions.ContentMd5 = options.HttpHeaders.ContentHash;
|
||||
}
|
||||
protocolLayerOptions.Metadata = options.Metadata;
|
||||
@ -1092,7 +1092,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
const UploadFileRangeFromUriOptions& options,
|
||||
const Azure::Core::Context& context) const
|
||||
{
|
||||
AZURE_ASSERT_MSG(sourceRange.Length.HasValue(), "Source length cannot be null");
|
||||
AZURE_ASSERT_MSG(sourceRange.Length.HasValue(), "Source length cannot be null.");
|
||||
int64_t rangeLength = sourceRange.Length.Value();
|
||||
|
||||
auto protocolLayerOptions = _detail::ShareRestClient::File::UploadRangeFromUrlOptions();
|
||||
@ -1105,7 +1105,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
{
|
||||
AZURE_ASSERT_MSG(
|
||||
options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Crc64,
|
||||
"This operation only supports CRC64 content hash");
|
||||
"This operation only supports CRC64 content hash.");
|
||||
}
|
||||
protocolLayerOptions.SourceContentCrc64 = options.TransactionalContentHash;
|
||||
if (options.SourceAccessCondition.IfMatchContentHash.HasValue())
|
||||
@ -1113,7 +1113,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
AZURE_ASSERT_MSG(
|
||||
options.SourceAccessCondition.IfMatchContentHash.Value().Algorithm
|
||||
== HashAlgorithm::Crc64,
|
||||
"This operation only supports CRC64 Source-If-Match condition");
|
||||
"This operation only supports CRC64 Source-If-Match condition.");
|
||||
}
|
||||
protocolLayerOptions.SourceIfMatchCrc64 = options.SourceAccessCondition.IfMatchContentHash;
|
||||
if (options.SourceAccessCondition.IfNoneMatchContentHash.HasValue())
|
||||
@ -1121,7 +1121,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
AZURE_ASSERT_MSG(
|
||||
options.SourceAccessCondition.IfNoneMatchContentHash.Value().Algorithm
|
||||
== HashAlgorithm::Crc64,
|
||||
"This operation only supports CRC64 Source-If-None-Match condition");
|
||||
"This operation only supports CRC64 Source-If-None-Match condition.");
|
||||
}
|
||||
protocolLayerOptions.SourceIfNoneMatchCrc64
|
||||
= options.SourceAccessCondition.IfNoneMatchContentHash;
|
||||
|
||||
@ -50,11 +50,11 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
|
||||
}
|
||||
else if (m_status == Azure::Core::OperationStatus::Failed)
|
||||
{
|
||||
throw Azure::Core::RequestFailedException("Operation failed");
|
||||
throw Azure::Core::RequestFailedException("Operation failed.");
|
||||
}
|
||||
else if (m_status == Azure::Core::OperationStatus::Cancelled)
|
||||
{
|
||||
throw Azure::Core::RequestFailedException("Operation was cancelled");
|
||||
throw Azure::Core::RequestFailedException("Operation was cancelled.");
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(period);
|
||||
|
||||
@ -21,7 +21,7 @@ namespace Azure { namespace Storage { namespace Sas {
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::invalid_argument("unknown ShareSasResource value");
|
||||
throw std::invalid_argument("Unknown ShareSasResource value.");
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Loading…
Reference in New Issue
Block a user