1 # Exception classes used in dak
3 # Copyright (C) 2008 Mark Hymers <mhy@debian.org>
5 ################################################################################
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 ################################################################################
23 class DakError(Exception):
24 """Base class for all simple errors in this module.
28 message -- explanation of the error
31 def __init__(self, message=""):
32 self.args = str(message)
33 self.message = str(message)
38 __all__ = ['DakError']
41 "ParseMaintError": """Exception raised for errors in parsing a maintainer field.""",
42 "ParseChangesError": """Exception raised for errors in parsing a changes file.""",
43 "InvalidDscError": """Exception raised for invalid dsc files.""",
44 "UnknownFormatError": """Exception raised for unknown Format: lines in changes files.""",
45 "NoFilesFieldError": """Exception raised for missing files field in dsc/changes.""",
46 "CantOpenError": """Exception raised when files can't be opened.""",
47 "CantOverwriteError": """Exception raised when files can't be overwritten.""",
48 "FileExistsError": """Exception raised when destination file exists.""",
49 "SendmailFailedError": """Exception raised when Sendmail invocation failed.""",
50 "NoFreeFilenameError": """Exception raised when no alternate filename was found.""",
51 "TransitionsError": """Exception raised when transitions file can't be parsed.""",
52 "NoSourceFieldError": """Exception raised - we cant find the source - wtf?"""
55 def construct_dak_exception(name, description):
58 setattr(Er, "__name__", name)
61 for e in dakerrors.keys():
62 globals()[e] = construct_dak_exception(e, dakerrors[e])
67 ################################################################################