From 7e2d97048a4f48fb84843803dda8fdd710edda08 Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Mon, 5 May 2008 16:16:03 +0200 Subject: [PATCH] Move the transitions exception into our own class too and use it --- ChangeLog | 5 +++++ dak/transitions.py | 8 +++----- daklib/dak_exceptions.py | 6 +++--- 3 files changed, 11 insertions(+), 8 deletions(-) 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 -- 2.39.5