forked from sendgrid/sendgrid-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.py
65 lines (49 loc) · 1.79 KB
/
exceptions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
################################################################
# Various types of extensible Twilio SendGrid related exceptions
################################################################
class SendGridException(Exception):
"""Wrapper/default SendGrid-related exception"""
pass
class ApiKeyIncludedException(SendGridException):
"""Exception raised for when Twilio SendGrid API Key included in message text"""
def __init__(self,
expression="Email body",
message="Twilio SendGrid API Key detected"):
"""Create an exception for when Twilio SendGrid API Key included in message text
:param expression: Input expression in which the error occurred
:type expression: string
:param message: Explanation of the error
:type message: string
"""
self._expression = None
self._message = None
if expression is not None:
self.expression = expression
if message is not None:
self.message = message
@property
def expression(self):
"""Input expression in which the error occurred
:rtype: string
"""
return self._expression
@expression.setter
def expression(self, value):
"""Input expression in which the error occurred
:param value: Input expression in which the error occurred
:type value: string
"""
self._expression = value
@property
def message(self):
"""Explanation of the error
:rtype: string
"""
return self._message
@message.setter
def message(self, value):
"""Explanation of the error
:param value: Explanation of the error
:type value: string
"""
self._message = value