Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from pathlib import Path 

2from typing import Dict 

3 

4from errors.common.exception import DppError 

5 

6 

7class DppArgparseError(DppError): 

8 pass 

9 

10 

11class DppAdditionalGcovOptionsWithoutCoverage(DppArgparseError): 

12 def __init__(self): 

13 super().__init__( 

14 f"'--additional-gcov-options' should be used with '--coverage' option" 

15 ) 

16 

17 

18class DppArgparseTaxonomyNotFoundError(DppArgparseError): 

19 def __init__(self, taxonomy_name: str): 

20 super().__init__(f"taxonomy '{taxonomy_name}' does not exist") 

21 self.taxonomy_name: str = taxonomy_name 

22 

23 

24class DppArgparseNotProjectDirectory(DppArgparseError): 

25 def __init__(self, path: Path): 

26 super().__init__(f"directory '{str(path)}' is not a defect taxonomy project") 

27 self.path: Path = path 

28 

29 

30class DppArgparseDefectIndexError(DppArgparseError): 

31 def __init__(self, index: int): 

32 super().__init__(f"invalid index '{index}' of defects") 

33 self.index: int = index 

34 

35 

36class DppArgparseFileNotFoundError(DppArgparseError, FileNotFoundError): 

37 def __init__(self, path: str): 

38 super().__init__() 

39 self.path: str = path 

40 

41 

42class DppArgparseInvalidEnvironment(DppArgparseError): 

43 def __init__(self, value: str): 

44 super().__init__( 

45 f"invalid environment variable format '{value}' (should be KEY=VALUE)" 

46 ) 

47 self.value: str = value 

48 

49 

50class DppArgparseInvalidConfigError(DppArgparseError): 

51 def __init__(self): 

52 super().__init__() 

53 

54 

55class DppArgparseConfigCorruptedError(DppArgparseError): 

56 def __init__(self, data: Dict): 

57 super().__init__(f"config is corrupted: {data}") 

58 self.data = data 

59 

60 

61class DppArgparseInvalidCaseExpressionError(DppArgparseError): 

62 def __init__(self, index: int, name: str, cases: int, expr: str): 

63 super().__init__( 

64 f"Defect#{index} of {name} has {cases} test cases, but expression was: {expr}" 

65 ) 

66 self.index: int = index 

67 self.name: str = name 

68 self.cases: int = cases 

69 self.expr: str = expr