Mailinglist Archive: zypp-commit (325 mails)

< Previous Next >
[zypp-commit] r7218 - in /trunk/libzypp/zypp/repo: RepoException.h RepoProvideFile.cc
  • From: dmacvicar@xxxxxxxxxxxxxxxx
  • Date: Wed, 12 Sep 2007 15:57:05 -0000
  • Message-id: <20070912155705.BF8CC35F10@xxxxxxxxxxxxxxxx>
Author: dmacvicar
Date: Wed Sep 12 17:57:05 2007
New Revision: 7218

URL: http://svn.opensuse.org/viewcvs/zypp?rev=7218&view=rev
Log:
better handling of exceptions here, remembering all errors.

Modified:
    trunk/libzypp/zypp/repo/RepoException.h
    trunk/libzypp/zypp/repo/RepoProvideFile.cc

Modified: trunk/libzypp/zypp/repo/RepoException.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepoException.h?rev=7218&r1=7217&r2=7218&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/RepoException.h (original)
+++ trunk/libzypp/zypp/repo/RepoException.h Wed Sep 12 17:57:05 2007
@@ -58,7 +58,21 @@
      */
     class RepoNoUrlException : public RepoException
     {
-    
+      public:
+      RepoNoUrlException()
+      {}
+      
+      RepoNoUrlException( const RepoInfo &info)
+        : _info(info)
+      {}
+      
+      ~RepoNoUrlException() throw()
+      {}
+      
+      RepoInfo info()
+      { return _info; }
+    private:
+      RepoInfo _info;
     };
     
     /**

Modified: trunk/libzypp/zypp/repo/RepoProvideFile.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepoProvideFile.cc?rev=7218&r1=7217&r2=7218&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/RepoProvideFile.cc (original)
+++ trunk/libzypp/zypp/repo/RepoProvideFile.cc Wed Sep 12 17:57:05 2007
@@ -191,7 +191,7 @@
                                               const OnMediaLocation & loc_r,
                                               const ProvideFilePolicy & policy_r )
     {
-      MIL << "provideFile " << loc_r << endl;
+      MIL << loc_r << endl;
       // Arrange DownloadFileReportHack to recieve the source::DownloadFileReport
       // and redirect download progress triggers to call the ProvideFilePolicy
       // callback.
@@ -202,14 +202,23 @@
 
       Url url;
       RepoInfo info = repo_r.info();
+      
+      RepoException repo_excpt(str::form(_("Can't provide file %s from repository %s"),
+                               loc_r.filename().c_str(),
+                               info.alias().c_str() ) );
+      
       if ( info.baseUrlsEmpty() )
-        ZYPP_THROW(Exception(_("No url in repository.")));
-
+      {
+        repo_excpt.remember(RepoException(_("No url in repository.")));
+        ZYPP_THROW(repo_excpt);
+      }
+      
       for ( RepoInfo::urls_const_iterator it = info.baseUrlsBegin();
             it != info.baseUrlsEnd();
-            ++it )
+            /* incremented in the loop */ )
       {
         url = *it;
+        ++it;
         try
         {
           MIL << "Providing file of repo '" << info.alias()
@@ -270,15 +279,15 @@
         catch ( const Exception &e )
         {
           ZYPP_CAUGHT( e );
+          
+          repo_excpt.remember(e);
+          
           WAR << "Trying next url" << endl;
           continue;
         }
       } // iteration over urls
 
-      ZYPP_THROW(Exception(str::form(_("Can't provide file %s from repository %s"),
-                                       loc_r.filename().c_str(),
-                                       info.alias().c_str() ) ) );
-
+      ZYPP_THROW(repo_excpt);
       return ManagedFile(); // not reached
     }
 

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages