use precondition instead of runtime exception (#2421)
This commit is contained in:
parent
686270743d
commit
83c265b463
@ -151,10 +151,8 @@ namespace Azure { namespace Storage {
|
||||
|
||||
std::vector<uint8_t> Sha256(const std::vector<uint8_t>& data)
|
||||
{
|
||||
if (data.size() > std::numeric_limits<ULONG>::max())
|
||||
{
|
||||
throw std::runtime_error("Data size is too big.");
|
||||
}
|
||||
AZURE_ASSERT_MSG(data.size() <= std::numeric_limits<ULONG>::max(), "Data size is too big.");
|
||||
|
||||
static AlgorithmProviderInstance AlgorithmProvider(AlgorithmType::Sha256);
|
||||
|
||||
std::string context;
|
||||
@ -202,10 +200,7 @@ namespace Azure { namespace Storage {
|
||||
const std::vector<uint8_t>& data,
|
||||
const std::vector<uint8_t>& key)
|
||||
{
|
||||
if (data.size() > std::numeric_limits<ULONG>::max())
|
||||
{
|
||||
throw std::runtime_error("Data size is too big.");
|
||||
}
|
||||
AZURE_ASSERT_MSG(data.size() <= std::numeric_limits<ULONG>::max(), "Data size is too big.");
|
||||
|
||||
static AlgorithmProviderInstance AlgorithmProvider(AlgorithmType::HmacSha256);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user