Coverage for error.py: 80%

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

35 statements  

1""" 

2error.py 

3 

4 This module contains the error classes. 

5""" 

6class AuthorisationError(Exception): 

7 """ 

8 Exception raised for errors in authorisation 

9 

10 Attributes: 

11 message -- explanation of the error 

12 """ 

13 

14 default_message = "User is not authorized" 

15 

16 def __init__(self, message=default_message): 

17 self.message = message 

18 super().__init__(self.message) 

19 

20 def __str__(self): 

21 return self.message 

22 

23class HelpNotFoundError(Exception): 

24 """ 

25 Exception raised for errors in help 

26 

27 Attributes: 

28 message -- explanation of the error 

29 """ 

30 

31 default_message = "Help not found" 

32 

33 def __init__(self, message=default_message): 

34 self.message = message 

35 super().__init__(self.message) 

36 

37 def __str__(self): 

38 return self.message 

39 

40class TimezoneNotFoundError(Exception): 

41 """ 

42 Exception raised for errors in timezones 

43 

44 Attributes: 

45 message -- explanation of the error 

46 """ 

47 

48 default_message = "Timezone not found" 

49 

50 def __init__(self, message=default_message): 

51 self.message = message 

52 super().__init__(self.message) 

53 

54 def __str__(self): 

55 return self.message 

56 

57class ArgumentRequiredError(Exception): 

58 """ 

59 Exception raised for when arguments are required 

60 

61 Attributes: 

62 message -- explanation of the error 

63 """ 

64 

65 default_message = "Argument(s) required" 

66 

67 def __init__(self, message=default_message): 

68 self.message = message 

69 super().__init__(self.message) 

70 

71 def __str__(self): 

72 return self.message 

73 

74class UnknownArgumentError(Exception): 

75 """ 

76 Exception raised for errors in too many arguments 

77 

78 Attributes: 

79 message -- explanation of the error 

80 """ 

81 

82 default_message = "Unknown argument(s)" 

83 

84 def __init__(self, message=default_message): 

85 self.message = message 

86 super().__init__(self.message) 

87 

88 def __str__(self): 

89 return self.message