From 291cf97f02ac7d53d034e0ace87dd0c20fe9cb22 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sun, 8 Aug 2010 10:37:42 +0200 Subject: [PATCH] [equo] handle OperationalError exceptions on listAllPackageIds() in text_rescue._database_check() --- client/text_rescue.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/client/text_rescue.py b/client/text_rescue.py index c62eb4b19..b4e4e6a5d 100644 --- a/client/text_rescue.py +++ b/client/text_rescue.py @@ -18,6 +18,7 @@ from entropy.const import etpConst, etpSys, etpUi from entropy.output import red, bold, brown, blue, darkred, darkgreen, purple, \ print_info, print_warning, print_error from entropy.exceptions import SystemDatabaseError +from entropy.db.exceptions import OperationalError import entropy.tools from entropy.client.interfaces import Client from entropy.i18n import _ @@ -725,11 +726,23 @@ def _database_check(entropy_client): importance = 2, level = "warning" ) - idpkgs = entropy_client.installed_repository().listAllPackageIds() - length = len(idpkgs) count = 0 errors = False scanning_txt = _("Scanning...") + length = 0 + idpkgs = [] + try: + idpkgs = entropy_client.installed_repository().listAllPackageIds() + length = len(idpkgs) + except OperationalError as err: + entropy.tools.print_traceback() + errors = True + entropy_client.output( + "%s: %s" % (darkred(_("Error")), err,), + importance = 1, + level = "warning" + ) + for x in idpkgs: count += 1 entropy_client.output( @@ -746,7 +759,7 @@ def _database_check(entropy_client): entropy.tools.print_traceback() errors = True entropy_client.output( - darkred(_("Errors on idpackage %s, error: %s")) % (x, e), + darkred(_("Errors on package id %s, error: %s")) % (x, e), importance = 0, level = "warning" )