Switch BaseProcessingFail.exception_path's separator from period to colon
[mediagoblin.git] / mediagoblin / process_media / errors.py
1 # GNU MediaGoblin -- federated, autonomous media hosting
2 # Copyright (C) 2011 Free Software Foundation, Inc
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU Affero General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU Affero General Public License for more details.
13 #
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 from mediagoblin.util import lazy_pass_to_ugettext as _
18
19 class BaseProcessingFail(Exception):
20 """
21 Base exception that all other processing failure messages should
22 subclass from.
23
24 You shouldn't call this itself; instead you should subclass it
25 and provid the exception_path and general_message applicable to
26 this error.
27 """
28 general_message = u''
29
30 @property
31 def exception_path(self):
32 return u"%s:%s" % (
33 self.__class__.__module__, self.__class__.__name__)
34
35 def __init__(self, **metadata):
36 self.metadata = metadata or {}
37
38
39 class BadMediaFail(BaseProcessingFail):
40 """
41 Error that should be raised when an inappropriate file was given
42 for the media type specified.
43 """
44 general_message = _(u'Invalid file given for media type.')