@@ -119,8 +119,8 @@ class Background(Signal):
119119 name : str = Field (default_factory = lambda : f"New Background { next (background_number )} " , min_length = 1 )
120120
121121 @model_validator (mode = "after" )
122- def warn_parameters (self ):
123- """Raise a warning if the parameters given are not expected for the given type."""
122+ def check_unsupported_parameters (self ):
123+ """Raise an error if the parameters given are not supported for the given type."""
124124 if self .type == TypeOptions .Constant :
125125 expected_empty_fields = ["value_1" , "value_2" , "value_3" , "value_4" , "value_5" ]
126126 elif self .type == TypeOptions .Data :
@@ -130,10 +130,9 @@ def warn_parameters(self):
130130
131131 non_empty_fields = [v for v in expected_empty_fields if getattr (self , v ) != "" ]
132132 if non_empty_fields :
133- warnings .warn (
134- "The following values are not recognised by this background type and will be ignored: "
135- f"{ ', ' .join (non_empty_fields )} " ,
136- stacklevel = 2 ,
133+ raise ValueError (
134+ f'The following values are not supported by the "{ self .type } " background type: '
135+ f"{ ', ' .join (non_empty_fields )} "
137136 )
138137
139138 return self
@@ -630,8 +629,8 @@ def validate_unimplemented_resolutions(cls, type: TypeOptions):
630629 return type
631630
632631 @model_validator (mode = "after" )
633- def warn_parameters (self ):
634- """Raise a warning if the parameters given are not expected for the given type."""
632+ def check_unsupported_parameters (self ):
633+ """Raise an error if the parameters given are not supported for the given type."""
635634 if self .type == TypeOptions .Constant :
636635 expected_empty_fields = ["value_1" , "value_2" , "value_3" , "value_4" , "value_5" ]
637636 elif self .type == TypeOptions .Data :
@@ -641,10 +640,9 @@ def warn_parameters(self):
641640
642641 non_empty_fields = [v for v in expected_empty_fields if getattr (self , v ) != "" ]
643642 if non_empty_fields :
644- warnings .warn (
645- "The following values are not recognised by this resolution type and will be ignored: "
646- f"{ ', ' .join (non_empty_fields )} " ,
647- stacklevel = 2 ,
643+ raise ValueError (
644+ f'The following values are not supported by the "{ self .type } " resolution type: '
645+ f"{ ', ' .join (non_empty_fields )} "
648646 )
649647
650648 return self
0 commit comments