Uses std::abort() instead of abort() or exception for precondition. (#1474)

This commit is contained in:
Kan Tang 2021-01-26 17:43:22 -08:00 committed by GitHub
parent 5f20767a4b
commit b3cdb2790c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 16 deletions

View File

@ -233,7 +233,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
if (options.ContentHash.HasValue()
&& options.ContentHash.GetValue().Algorithm != HashAlgorithm::Md5)
{
abort();
std::abort();
}
protocolLayerOptions.ContentMd5 = options.ContentHash;
protocolLayerOptions.LeaseIdOptional = options.AccessConditions.LeaseId;
@ -424,7 +424,8 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
protocolLayerOptions.ExpiryOrigin = expiryOrigin;
if (options.ExpiresOn.HasValue() && options.TimeToExpireInMs.HasValue())
{
throw std::runtime_error("ExpiresOn and TimeToExpireInMs should be mutually exlusive.");
// ExpiresOn and TimeToExpireInMs should be mutually exlusive.
std::abort();
}
if (options.ExpiresOn.HasValue())
{

View File

@ -471,10 +471,6 @@ namespace Azure { namespace Storage { namespace Test {
Files::DataLake::ScheduleDataLakeFileExpiryOriginType::Absolute, options),
StorageException);
options.ExpiresOn = "Tue, 29 Sep 2100 09:53:03 GMT";
EXPECT_THROW(
client.ScheduleDeletion(
Files::DataLake::ScheduleDataLakeFileExpiryOriginType::Absolute, options),
std::runtime_error);
options.TimeToExpireInMs = Azure::Core::Nullable<int64_t>();
EXPECT_NO_THROW(client.ScheduleDeletion(
Files::DataLake::ScheduleDataLakeFileExpiryOriginType::Absolute, options));

View File

@ -180,7 +180,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
if (options.HttpHeaders.ContentHash.Algorithm != HashAlgorithm::Md5)
{
abort();
std::abort();
}
protocolLayerOptions.ContentMd5 = options.HttpHeaders.ContentHash;
}
@ -346,9 +346,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
throw std::runtime_error(
"FilePermission or FilePermissionKey must be set if FilePermissionCopyMode is set to "
"PermissionCopyModeType::Override.");
// FilePermission or FilePermissionKey must be set if FilePermissionCopyMode is set to
// PermissionCopyModeType::Override.
std::abort();
}
}
}
@ -478,7 +478,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
if (options.TransactionalContentHash.HasValue()
&& options.TransactionalContentHash.GetValue().Algorithm != HashAlgorithm::Md5)
{
abort();
std::abort();
}
protocolLayerOptions.ContentMd5 = options.TransactionalContentHash;
protocolLayerOptions.LeaseIdOptional = options.AccessConditions.LeaseId;
@ -891,7 +891,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
if (options.HttpHeaders.ContentHash.Algorithm != HashAlgorithm::Md5)
{
abort();
std::abort();
}
protocolLayerOptions.ContentMd5 = options.HttpHeaders.ContentHash;
}
@ -991,7 +991,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
if (options.HttpHeaders.ContentHash.Algorithm != HashAlgorithm::Md5)
{
abort();
std::abort();
}
protocolLayerOptions.ContentMd5 = options.HttpHeaders.ContentHash;
}

View File

@ -652,9 +652,6 @@ namespace Azure { namespace Storage { namespace Test {
auto destFileClient
= m_shareClient->GetRootDirectoryClient().GetFileClient(LowercaseRandomString(10));
Files::Shares::StartCopyShareFileOptions copyOptions;
copyOptions.PermissionCopyMode = Files::Shares::Models::PermissionCopyModeType::Override;
EXPECT_THROW(destFileClient.StartCopy(fileClient.GetUrl(), copyOptions), std::runtime_error);
}
}