Skip to main content

DefaultFactoryAndDefaultValueError

This class is an exception raised when both a default factory and a default value are simultaneously specified for a parameter. It captures the name of the problematic argument and the associated parameter type to provide a descriptive error message.

Attributes

AttributeTypeDescription
argument_namestrThe name of the argument that incorrectly specified both a default factory and a default value.
param_typetype[[ParameterInfo](../models/parameterinfo.md?sid=typer_models_parameterinfo)]The specific parameter information class type associated with the conflicting default value definitions.

Constructor

Signature

def DefaultFactoryAndDefaultValueError(
argument_name: str,
param_type: type[[ParameterInfo](../models/parameterinfo.md?sid=typer_models_parameterinfo)]
) - > null

Parameters

NameTypeDescription
argument_namestrThe name of the argument where both a default value and a default factory were provided.
param_typetype[[ParameterInfo](../models/parameterinfo.md?sid=typer_models_parameterinfo)]The type of the parameter associated with the error.

Signature

def DefaultFactoryAndDefaultValueError(
argument_name: str,
param_type: type[[ParameterInfo](../models/parameterinfo.md?sid=typer_models_parameterinfo)]
) - > null

Parameters

NameTypeDescription
argument_namestrThe name of the argument where both a default value and a default factory were provided.
param_typetype[[ParameterInfo](../models/parameterinfo.md?sid=typer_models_parameterinfo)]The class type of the parameter being processed, used to generate a user-friendly error message.