44from pptx .slide import SlideLayouts as PptxSlideLayouts
55
66
7- class tpptException (Exception ):
7+ class TpptException (Exception ):
88 """Base exception for tppt."""
99
1010 @property
@@ -19,7 +19,7 @@ def __str__(self) -> str:
1919 return self .message
2020
2121
22- class ColorInvalidFormatError (tpptException , ValueError ):
22+ class ColorInvalidFormatError (TpptException , ValueError ):
2323 """Color format is invalid."""
2424
2525 def __init__ (self , color : str ) -> None :
@@ -30,7 +30,7 @@ def message(self) -> str:
3030 return f"Invalid color format: { self .color } "
3131
3232
33- class SlideLayoutIndexError (tpptException , IndexError ):
33+ class SlideLayoutIndexError (TpptException , IndexError ):
3434 """Slide layout index is out of range."""
3535
3636 def __init__ (self , index : int , slide_layouts : PptxSlideLayouts ) -> None :
@@ -40,3 +40,25 @@ def __init__(self, index: int, slide_layouts: PptxSlideLayouts) -> None:
4040 @property
4141 def message (self ) -> str :
4242 return f"Slide layout index { self .index } is out of range. Available slide layouts: { [layout .name for layout in self .slide_layouts ]} "
43+
44+
45+ class SlideMasterAttributeMustBeSlideLayoutError (TpptException , ValueError ):
46+ """Slide master attribute must be a slide layout."""
47+
48+ def __init__ (self , slide_layout_name : str ) -> None :
49+ self .slide_layout_name = slide_layout_name
50+
51+ @property
52+ def message (self ) -> str :
53+ return f"The slide master attribute must be a slide layout. The { self .slide_layout_name } layout is not a slide layout."
54+
55+
56+ class SlideMasterAttributeNotFoundError (TpptException , ValueError ):
57+ """Slide master attribute not found."""
58+
59+ def __init__ (self , slide_layout_name : str ) -> None :
60+ self .slide_layout_name = slide_layout_name
61+
62+ @property
63+ def message (self ) -> str :
64+ return f"The slide master does not have an attribute for the { self .slide_layout_name } layout"
0 commit comments