4 Exception classes used in dak
6 @contact: Debian FTP Master <ftpmaster@debian.org>
7 @copyright: 2008 Mark Hymers <mhy@debian.org>
8 @license: GNU General Public License version 2 or later
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 class DakError(Exception):
28 Base class for all simple errors in this module.
32 def __init__(self, message=""):
35 @param message: explanation of the error
38 Exception.__init__(self)
39 self.args = str(message)
40 self.message = str(message)
45 __all__ = ['DakError']
47 # If you want to have a new exception in dak, add it here.
49 "ParseMaintError": """Exception raised for errors in parsing a maintainer field.""",
50 "ParseChangesError": """Exception raised for errors in parsing a changes file.""",
51 "InvalidDscError": """Exception raised for invalid dsc files.""",
52 "UnknownFormatError": """Exception raised for unknown Format: lines in changes files.""",
53 "NoFilesFieldError": """Exception raised for missing files field in dsc/changes.""",
54 "CantOpenError": """Exception raised when files can't be opened.""",
55 "CantOverwriteError": """Exception raised when files can't be overwritten.""",
56 "FileExistsError": """Exception raised when destination file exists.""",
57 "SendmailFailedError": """Exception raised when Sendmail invocation failed.""",
58 "NoFreeFilenameError": """Exception raised when no alternate filename was found.""",
59 "TransitionsError": """Exception raised when transitions file can't be parsed.""",
60 "NoSourceFieldError": """Exception raised - we cant find the source - wtf?""",
61 "MissingContents": """Exception raised - we could not determine contents for this deb""",
62 "DBUpdateError": """Exception raised - could not update the database""",
63 "ChangesUnicodeError": """Exception raised - changes file not properly utf-8 encoded""",
64 "AlreadyLockedError": """Exception raised - package already locked by someone else"""
65 } #: All dak exceptions
67 def construct_dak_exception(name, description):
70 setattr(Er, "__name__", name)
73 for e in dakerrors.keys():
74 globals()[e] = construct_dak_exception(e, dakerrors[e])
79 ################################################################################