Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/sendgrid/helpers/mail/exceptions.py: 53%

22 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2023-07-17 14:22 -0600

1################################################################ 

2# Various types of extensible Twilio SendGrid related exceptions 

3################################################################ 

4 

5 

6class SendGridException(Exception): 

7 """Wrapper/default SendGrid-related exception""" 

8 pass 

9 

10 

11class ApiKeyIncludedException(SendGridException): 

12 """Exception raised for when Twilio SendGrid API Key included in message text""" 

13 

14 def __init__(self, 

15 expression="Email body", 

16 message="Twilio SendGrid API Key detected"): 

17 """Create an exception for when Twilio SendGrid API Key included in message text 

18 

19 :param expression: Input expression in which the error occurred 

20 :type expression: string 

21 :param message: Explanation of the error 

22 :type message: string 

23 """ 

24 self._expression = None 

25 self._message = None 

26 

27 if expression is not None: 

28 self.expression = expression 

29 

30 if message is not None: 

31 self.message = message 

32 

33 @property 

34 def expression(self): 

35 """Input expression in which the error occurred 

36 

37 :rtype: string 

38 """ 

39 return self._expression 

40 

41 @expression.setter 

42 def expression(self, value): 

43 """Input expression in which the error occurred 

44 

45 :param value: Input expression in which the error occurred 

46 :type value: string 

47 """ 

48 self._expression = value 

49 

50 @property 

51 def message(self): 

52 """Explanation of the error 

53 

54 :rtype: string 

55 """ 

56 return self._message 

57 

58 @message.setter 

59 def message(self, value): 

60 """Explanation of the error 

61 

62 :param value: Explanation of the error 

63 :type value: string 

64 """ 

65 self._message = value