From 9de8be4af611aad0aedeffd67696ee0582b76ae9 Mon Sep 17 00:00:00 2001 From: James Troup Date: Tue, 26 Nov 2002 15:49:16 +0000 Subject: [PATCH] wrapper for print_exc() --- jenna | 7 ++----- utils.py | 12 +++++++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/jenna b/jenna index 24cc0d9d..8475612e 100755 --- a/jenna +++ b/jenna @@ -2,7 +2,7 @@ # Generate file lists used by apt-ftparchive to generate Packages and Sources files # Copyright (C) 2000, 2001, 2002 James Troup -# $Id: jenna,v 1.22 2002-11-22 04:06:32 troup Exp $ +# $Id: jenna,v 1.23 2002-11-26 15:49:16 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -417,10 +417,7 @@ def main(): projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])); db_access.init(Cnf, projectB); Logger = logging.Logger(Cnf, "jenna"); - try: - do_da_do_da(); - except: - utils.print_exc(); + utils.try_with_debug(do_da_do_da); Logger.close(); ######################################################################################### diff --git a/utils.py b/utils.py index ce9f4f4a..f680a352 100644 --- a/utils.py +++ b/utils.py @@ -2,7 +2,7 @@ # Utility functions # Copyright (C) 2000, 2001, 2002 James Troup -# $Id: utils.py,v 1.52 2002-11-22 04:06:34 troup Exp $ +# $Id: utils.py,v 1.53 2002-11-26 15:49:16 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -643,6 +643,16 @@ def print_exc(): ################################################################################ +def try_with_debug(function): + try: + function(); + except SystemExit: + raise; + except: + print_exc(); + +################################################################################ + apt_pkg.init() Cnf = apt_pkg.newConfiguration(); -- GitLab