|
1 #!/usr/bin/env python |
|
2 # |
|
3 # Copyright 2007 Google Inc. |
|
4 # |
|
5 # Licensed under the Apache License, Version 2.0 (the "License"); |
|
6 # you may not use this file except in compliance with the License. |
|
7 # You may obtain a copy of the License at |
|
8 # |
|
9 # http://www.apache.org/licenses/LICENSE-2.0 |
|
10 # |
|
11 # Unless required by applicable law or agreed to in writing, software |
|
12 # distributed under the License is distributed on an "AS IS" BASIS, |
|
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 # See the License for the specific language governing permissions and |
|
15 # limitations under the License. |
|
16 # |
|
17 |
|
18 """Exceptions raised my mail API.""" |
|
19 |
|
20 |
|
21 class Error(Exception): |
|
22 """Base Mail error type.""" |
|
23 |
|
24 class BadRequestError(Error): |
|
25 """Email is not valid.""" |
|
26 |
|
27 class InvalidSenderError(Error): |
|
28 """Sender is not a permitted to send mail for this application.""" |
|
29 |
|
30 class InvalidEmailError(Error): |
|
31 """Bad email set on an email field.""" |
|
32 |
|
33 class InvalidAttachmentTypeError(Error): |
|
34 """Invalid file type for attachments. We don't send viruses!""" |
|
35 |
|
36 class MissingRecipientsError(Error): |
|
37 """No recipients specified in message.""" |
|
38 |
|
39 class MissingSenderError(Error): |
|
40 """No sender specified in message.""" |
|
41 |
|
42 class MissingSubjectError(Error): |
|
43 """Subject not specified in message.""" |
|
44 |
|
45 class MissingBodyError(Error): |
|
46 """No body specified in message.""" |