mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
better error messages
This commit is contained in:
parent
a8db0b40d0
commit
7ee2e68f5b
@ -732,10 +732,18 @@ DataTypePtr FunctionArrayElement::getReturnTypeImpl(const DataTypes & arguments)
|
||||
{
|
||||
const DataTypeArray * array_type = checkAndGetDataType<DataTypeArray>(arguments[0].get());
|
||||
if (!array_type)
|
||||
throw Exception("First argument for function " + getName() + " must be array.", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
{
|
||||
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"First argument for function '{}' must be array, got '{}' instead",
|
||||
getName(), arguments[0]->getName());
|
||||
}
|
||||
|
||||
if (!isInteger(arguments[1]))
|
||||
throw Exception("Second argument for function " + getName() + " must be integer.", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
{
|
||||
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Second argument for function '{}' must be integer, got '{}' instead",
|
||||
getName(), arguments[1]->getName());
|
||||
}
|
||||
|
||||
return array_type->getNestedType();
|
||||
}
|
||||
|
@ -49,8 +49,11 @@ public:
|
||||
{
|
||||
const DataTypeAggregateFunction * type = checkAndGetDataType<DataTypeAggregateFunction>(arguments[0].get());
|
||||
if (!type)
|
||||
throw Exception("Argument for function " + getName() + " must have type AggregateFunction - state of aggregate function.",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
{
|
||||
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Argument for function '{}' must have type AggregateFunction - state of aggregate function."
|
||||
" Got '{}' instead", getName(), arguments[0]->getName());
|
||||
}
|
||||
|
||||
return type->getReturnType();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user