-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementImprovements to existing features or smaller new featuresImprovements to existing features or smaller new featuresnew featureNew feature that is not (only) a validator classNew feature that is not (only) a validator class
Milestone
Description
Currently, if a custom Default class raises an exception, this exception would not be handled.
A potential use case for this are "conditional defaults": Having a field that is required under certain (external) conditions, but has a default otherwise. The Default object would either return a default value or raise an exception if the field is supposed to be required.
Proposal: The DataclassValidator should catch specific exceptions when filling in default values and treat them as "this field is required". However, this should not allow just any exception. There should be either a specific new exception for this usecase (NoDefaultException?), or the DictRequiredFieldError should be used.
Metadata
Metadata
Assignees
Labels
enhancementImprovements to existing features or smaller new featuresImprovements to existing features or smaller new featuresnew featureNew feature that is not (only) a validator classNew feature that is not (only) a validator class