@@ -606,7 +606,7 @@ def _structure_set(
606606 ix ,
607607 elem_type ,
608608 )
609- exc .__notes__ = [* getattr (e , "__notes__" , []), msg ]
609+ exc .__notes__ = [* getattr (exc , "__notes__" , []), msg ]
610610 errors .append (exc )
611611 finally :
612612 ix += 1
@@ -673,7 +673,7 @@ def _structure_tuple(self, obj: Any, tup: Type[T]) -> T:
673673 msg = IterableValidationNote (
674674 f"Structuring { tup } @ index { ix } " , ix , tup_type
675675 )
676- exc .__notes__ = [* getattr (e , "__notes__" , []), msg ]
676+ exc .__notes__ = [* getattr (exc , "__notes__" , []), msg ]
677677 errors .append (exc )
678678 finally :
679679 ix += 1
@@ -704,13 +704,13 @@ def _structure_tuple(self, obj: Any, tup: Type[T]) -> T:
704704 msg = IterableValidationNote (
705705 f"Structuring { tup } @ index { ix } " , ix , t
706706 )
707- exc .__notes__ = [* getattr (e , "__notes__" , []), msg ]
707+ exc .__notes__ = [* getattr (exc , "__notes__" , []), msg ]
708708 errors .append (exc )
709709 if len (res ) < exp_len :
710710 problem = "Not enough" if len (res ) < len (tup_params ) else "Too many"
711711 exc = ValueError (f"{ problem } values in { obj !r} to structure as { tup !r} " )
712712 msg = f"Structuring { tup } "
713- exc .__notes__ = [* getattr (e , "__notes__" , []), msg ]
713+ exc .__notes__ = [* getattr (exc , "__notes__" , []), msg ]
714714 errors .append (exc )
715715 if errors :
716716 raise IterableValidationError (f"While structuring { tup !r} " , errors , tup )
0 commit comments