1+ from xml .etree .ElementTree import Element
2+
3+
14class GdValueError (ValueError ):
25 """Base class for exceptions raised during conversion."""
36
@@ -8,22 +11,32 @@ def __init__(self, message: str) -> None:
811class MissingTitleError (GdValueError ):
912 """Title missing from SVG element."""
1013
11- def __init__ (self , g ) -> None :
12- super ().__init__ ("Title missing from SVG element." )
13- self .g = g
14+ def __init__ (self , g : Element ) -> None :
15+ super ().__init__ (
16+ f"Title missing from SVG element: { g .tag } with attributes { g .attrib } ." ,
17+ )
18+
19+
20+ class MissingTextError (GdValueError ):
21+ """Title missing from SVG element."""
22+
23+ def __init__ (self , g : Element ) -> None :
24+ super ().__init__ (
25+ f"Text missing from SVG element: { g .tag } with attributes { g .attrib } ." ,
26+ )
1427
1528
1629class InvalidBezierParameterError (GdValueError ):
1730 """Invalid Bezier parameter, must be 0 <= t <= 1."""
1831
19- def __init__ (self , t ) -> None :
32+ def __init__ (self , t : float ) -> None :
2033 super ().__init__ (f"Invalid Bezier parameter (t={ t } ), must be 0 <= t <= 1." )
2134
2235
2336class MissingIdentifiersError (GdValueError ):
2437 """Missing identifiers for a geometry."""
2538
26- def __init__ (self , sid , gid ) -> None :
39+ def __init__ (self , sid : str | None , gid : str | None ) -> None :
2740 super ().__init__ (
2841 f"Missing identifiers for a geometry: sid(id): { sid } , gid(title): { gid } ." ,
2942 )
0 commit comments