From b85dacf5cfdb3dbc61b95641863709242fa1298f Mon Sep 17 00:00:00 2001 From: Jan Kupec Date: Fri, 31 Aug 2007 12:34:19 +0000 Subject: [PATCH] - fixed error message of zypper ar -r (#306667) --- src/zypper-misc.cc | 1 - src/zypper-sources.cc | 31 ++++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/zypper-misc.cc b/src/zypper-misc.cc index 7df1ab7..ba971a2 100644 --- a/src/zypper-misc.cc +++ b/src/zypper-misc.cc @@ -13,7 +13,6 @@ #include #include -#include #include diff --git a/src/zypper-sources.cc b/src/zypper-sources.cc index 605656a..28e5f8a 100644 --- a/src/zypper-sources.cc +++ b/src/zypper-sources.cc @@ -784,8 +784,37 @@ int add_repo_from_file(const std::string & repo_file_url, //! \todo handle local .repo files, validate the URL Url url(repo_file_url); RepoManager manager; - list repos = readRepoFile(url); + list repos; + + // read the repo file + try { repos = readRepoFile(url); } + catch (const media::MediaException & e) + { + ZYPP_CAUGHT(e); + report_problem(e, + _("Problem accessing the file at the specified URL") + string(":"), + _("Please check if the URL is valid and accessible.")); + return ZYPPER_EXIT_ERR_ZYPP; + } + catch (const parser::ParseException & e) + { + ZYPP_CAUGHT(e); + report_problem(e, + _("Problem parsing the file at the specified URL") + string(":"), + // TranslatorExplanation don't translate the URL if the URL itself is not translated. + // Also don't translate the '.repo' string. + _("Is it a .repo file? See http://en.opensuse.org/Standards/RepoInfo for details.")); + return ZYPPER_EXIT_ERR_ZYPP; + } + catch (const Exception & e) + { + ZYPP_CAUGHT(e); + report_problem(e, + _("Problem encountered while trying to read the file at the specified URL") + string(":")); + return ZYPPER_EXIT_ERR_ZYPP; + } + // add repos for (list::const_iterator it = repos.begin(); it != repos.end(); ++it) { -- 2.7.4