mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 19:12:03 +00:00
Improve exception text
This commit is contained in:
parent
d0506f0214
commit
12608d2090
@ -26,7 +26,7 @@ struct BitShiftLeftImpl
|
||||
if constexpr (is_big_int_v<B>)
|
||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "BitShiftLeft is not implemented for big integers as second argument");
|
||||
else if (b < 0 || static_cast<UInt256>(b) > 8 * sizeof(A))
|
||||
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "The number of shift positions needs to be a positive value and not greater than the bit width of the value to shift");
|
||||
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "The number of shift positions needs to be a non-negative value and less or equal to the bit width of the value to shift");
|
||||
else if constexpr (is_big_int_v<A>)
|
||||
return static_cast<Result>(a) << static_cast<UInt32>(b);
|
||||
else
|
||||
@ -43,7 +43,7 @@ struct BitShiftLeftImpl
|
||||
UInt8 word_size = 8;
|
||||
size_t n = end - pos;
|
||||
if (b < 0 || b > B(word_size * n))
|
||||
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "The number of shift positions needs to be a positive value and not greater than the bit width of the value to shift");
|
||||
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "The number of shift positions needs to be a non-negative value and less or equal to the bit width of the value to shift");
|
||||
|
||||
/// To prevent overflow
|
||||
if (static_cast<double>(b) >= (static_cast<double>(n) * word_size))
|
||||
@ -112,7 +112,7 @@ struct BitShiftLeftImpl
|
||||
UInt8 word_size = 8;
|
||||
size_t n = end - pos;
|
||||
if (b < 0 || b > B(word_size * n))
|
||||
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "The number of shift positions needs to be a positive value and not greater than the bit width of the value to shift");
|
||||
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "The number of shift positions needs to be a non-negative value and less or equal to the bit width of the value to shift");
|
||||
/// To prevent overflow
|
||||
if (static_cast<double>(b) >= (static_cast<double>(n) * word_size))
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ struct BitShiftRightImpl
|
||||
if constexpr (is_big_int_v<B>)
|
||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "BitShiftRight is not implemented for big integers as second argument");
|
||||
else if (b < 0 || static_cast<UInt256>(b) > 8 * sizeof(A))
|
||||
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "The number of shift positions needs to be a positive value and not greater than the bit width of the value to shift");
|
||||
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "The number of shift positions needs to be a non-negative value and less or equal to the bit width of the value to shift");
|
||||
else if constexpr (is_big_int_v<A>)
|
||||
return static_cast<Result>(a) >> static_cast<UInt32>(b);
|
||||
else
|
||||
@ -59,7 +59,7 @@ struct BitShiftRightImpl
|
||||
UInt8 word_size = 8;
|
||||
size_t n = end - pos;
|
||||
if (b < 0 || b > B(word_size * n))
|
||||
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "The number of shift positions needs to be a positive value and not greater than the bit width of the value to shift");
|
||||
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "The number of shift positions needs to be a non-negative value and less or equal to the bit width of the value to shift");
|
||||
/// To prevent overflow
|
||||
if (static_cast<double>(b) >= (static_cast<double>(n) * word_size))
|
||||
{
|
||||
@ -99,7 +99,7 @@ struct BitShiftRightImpl
|
||||
UInt8 word_size = 8;
|
||||
size_t n = end - pos;
|
||||
if (b < 0 || b > B(word_size * n))
|
||||
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "The number of shift positions needs to be a positive value and not greater than the bit width of the value to shift");
|
||||
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "The number of shift positions needs to be a non-negative value and less or equal to the bit width of the value to shift");
|
||||
/// To prevent overflow
|
||||
if (static_cast<double>(b) >= (static_cast<double>(n) * word_size))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user