Loading...

verticapy.errors.FunctionError

exception verticapy.errors.FunctionError

An exception raised when an error occurs during the execution of a function. This error typically indicates issues such as incorrect usage, invalid parameters, or challenges within the function’s implementation, preventing the successful completion of the intended operation.

Examples

The following function checks if the input aggregation is supported. It raises an error if that is not the case.

from verticapy.errors import ModelError

def is_supported_agg(agg_type: str):

    if agg_type.lower() not in ('avg', 'sum', 'var'):

        raise FunctionError(
            f"The aggregation '{agg_type}' is not yet supported."
        )

Note

FunctionError is a subclass of ValueError.

Note

Errors can be employed when implementing new functions to provide clear explanations for why a particular option or feature is not functioning as intended. It is essential to review all available errors to choose the most appropriate one.