From: Joerg Jaspert Date: Mon, 5 May 2008 14:16:03 +0000 (+0200) Subject: Move the transitions exception into our own class too and use it X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;ds=sidebyside;h=7e2d97048a4f48fb84843803dda8fdd710edda08;hp=462582a3aa14eb8cfc4e48a8908fd3452ca181f4;p=dak.git Move the transitions exception into our own class too and use it --- diff --git a/ChangeLog b/ChangeLog index 869ff621..bdb58f18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-05-05 Joerg Jaspert + + * daklib/dak_exceptions.py (dakerrors): add TransitionsError + * dak/transitions.py: Use it, instead of the own definition + 2008-05-05 Mark Hymers * daklib/dak_exceptions.py: Add a default message and tidy up our string diff --git a/dak/transitions.py b/dak/transitions.py index 7a0da2e1..b69c5732 100755 --- a/dak/transitions.py +++ b/dak/transitions.py @@ -27,6 +27,7 @@ import os, pg, sys, time, errno, fcntl, tempfile, pwd, re import apt_pkg import daklib.database as database import daklib.utils as utils +from daklib.dak_extensions import TransitionsError import syck # Globals @@ -227,9 +228,6 @@ def write_transitions(from_trans): ################################################################################ -class ParseException(Exception): - pass - ########################################## #### This usually runs within sudo !! #### ########################################## @@ -248,7 +246,7 @@ def write_transitions_from_file(from_file): else: trans = load_transitions(from_file) if trans is None: - raise ParseException, "Unparsable transitions file %s" % (file) + raise TransitionsError, "Unparsable transitions file %s" % (file) write_transitions(trans) ################################################################################ @@ -458,7 +456,7 @@ def main(): if Options["import"]: try: write_transitions_from_file(Options["import"]) - except ParseException, m: + except TransitionsError, m: print m sys.exit(2) sys.exit(0) diff --git a/daklib/dak_exceptions.py b/daklib/dak_exceptions.py index e488ac9d..b52e0657 100644 --- a/daklib/dak_exceptions.py +++ b/daklib/dak_exceptions.py @@ -44,13 +44,13 @@ dakerrors = { "UnknownFormatError": """Exception raised for unknown Format: lines in changes files.""", "NoFilesFieldError": """Exception raised for missing files field in dsc/changes.""", "CantOpenError": """Exception raised when files can't be opened.""", - "CantOverwriteError": """Exception raised when files cant be overwritten.""", + "CantOverwriteError": """Exception raised when files can't be overwritten.""", "FileExistsError": """Exception raised when destination file exists.""", "SendmailFailedError": """Exception raised when Sendmail invocation failed.""", - "NoFreeFilenameError": """Exception raised when no alternate filename was found.""" + "NoFreeFilenameError": """Exception raised when no alternate filename was found.""", + "TransitionsError": """Exception raised when transitions file can't be parsed.""" } - def construct_dak_exception(name, description): class Er(DakError): __doc__ = description