Coverage for tembo/exceptions.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

12 statements  

1"""Module containing custom exceptions.""" 

2 

3 

4class MismatchedTokenError(Exception): 

5 """ 

6 Raised when the number of input tokens does not match the user config. 

7 

8 Attributes: 

9 expected (int): number of input tokens in the user config. 

10 given (int): number of input tokens passed in. 

11 """ 

12 

13 def __init__(self, expected: int, given: int) -> None: 

14 """ 

15 Initialise the exception. 

16 

17 Args: 

18 expected (int): number of input tokens in the user config. 

19 given (int): number of input tokens passed in. 

20 """ 

21 self.expected = expected 

22 self.given = given 

23 super().__init__() 

24 

25 

26class BasePathDoesNotExistError(Exception): 

27 """Raised if the base path does not exist.""" 

28 

29 

30class TemplateFileNotFoundError(Exception): 

31 """Raised if the template file does not exist.""" 

32 

33 

34class ScopedPageAlreadyExists(Exception): 

35 """Raised if the scoped page file already exists.""" 

36 

37 

38class MissingConfigYML(Exception): 

39 """Raised if the config.yml file is missing.""" 

40 

41 

42class EmptyConfigYML(Exception): 

43 """Raised if the config.yml file is empty.""" 

44 

45 

46class ScopeNotFound(Exception): 

47 """Raised if the scope does not exist in the config.yml.""" 

48 

49 

50class MandatoryKeyNotFound(Exception): 

51 """Raised if a mandatory key is not found in the config.yml."""