From 47aef565c932c41b08855e153bea070d598627b2 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Wed, 18 Oct 2006 19:39:05 +0000 Subject: [PATCH] a slightly better handling of source-delete exceptions --- tools/zmart/zmart-sources.cc | 11 ++++++++++- tools/zmart/zypper.cc | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/zmart/zmart-sources.cc b/tools/zmart/zmart-sources.cc index 557afa1..80a25c2 100644 --- a/tools/zmart/zmart-sources.cc +++ b/tools/zmart/zmart-sources.cc @@ -282,7 +282,16 @@ void remove_source( const std::string& anystring ) cerr_vv << "Constructing SourceManager" << endl; SourceManager_Ptr manager = SourceManager::sourceManager(); cerr_vv << "Restoring SourceManager" << endl; - manager->restore ("/", true /*use_cache*/); + try { + manager->restore ("/", true /*use_cache*/); + } + catch (const Exception & ex) { + // so what if sources cannot be restored + // we want to delete anyway + ZYPP_CAUGHT (ex); + cerr << ex.asUserString () << endl + << "Continuing anyway" << endl; + } SourceManager::SourceId sid = 0; safe_lexical_cast (anystring, sid); diff --git a/tools/zmart/zypper.cc b/tools/zmart/zypper.cc index b743ad5..d56e565 100644 --- a/tools/zmart/zypper.cc +++ b/tools/zmart/zypper.cc @@ -514,6 +514,7 @@ int main(int argc, char **argv) } catch ( const Exception & excpt_r ) { + ZYPP_CAUGHT (excpt_r); cerr << excpt_r.asUserString() << endl; return 1; } -- 2.7.4