throw if solv file loading fails
authorMichael Andres <ma@suse.de>
Mon, 4 Feb 2008 19:23:17 +0000 (19:23 +0000)
committerMichael Andres <ma@suse.de>
Mon, 4 Feb 2008 19:23:17 +0000 (19:23 +0000)
zypp/sat/Repo.cc
zypp/sat/Repo.h
zypp/sat/detail/PoolImpl.h

index 156e252..909d562 100644 (file)
@@ -99,6 +99,7 @@ namespace zypp
       _id = detail::noRepoId;
     }
 
+#warning NEED POOL MANIP EXEPTIONS
     void Repo::addSolv( const Pathname & file_r )
     {
       NO_REPO_THROW( Exception( _("Can't add solvables to norepo.") ) );
@@ -107,10 +108,13 @@ namespace zypp
       if ( file == NULL )
       {
         file.resetDispose();
-        ZYPP_THROW( Exception( _("Can't read solv-file: ")+file_r.asString() ) );
+        ZYPP_THROW( Exception( _("Can't open solv-file: ")+file_r.asString() ) );
       }
 
-      myPool()._addSolv( _repo, file );
+      if ( myPool()._addSolv( _repo, file ) != 0 )
+      {
+        ZYPP_THROW( Exception( _("Error reading solv-file: ")+file_r.asString() ) );
+      }
     }
 
     detail::SolvableIdType Repo::addSolvables( unsigned count_r )
index 08a7b43..2823040 100644 (file)
@@ -90,7 +90,9 @@ namespace zypp
          */
         //@{
         /** Load \ref Solvables from a solv-file.
+         * In case of an exception the repo remains in the \ref Pool.
          * \throws Exception if loading the solv-file fails.
+         * \see \ref Pool::addRepoSolv and \ref Repo::EraseFromPool
          */
         void addSolv( const Pathname & file_r );
 
@@ -130,6 +132,7 @@ namespace zypp
     // CLASS NAME : Repo::EraseFromPool
     //
     /** Functor removing \ref Repo from it's \ref Pool.
+     *
      * E.g. used as dispose function in. \ref AutoDispose
      * to provide a convenient and exception safe temporary
      * \ref Repo.
index a057c4c..087fc76 100644 (file)
@@ -90,10 +90,10 @@ namespace zypp
           }
 
           /** Adding solv file to a repo. */
-          void _addSolv( ::_Repo * repo_r, FILE * file_r )
+          int _addSolv( ::_Repo * repo_r, FILE * file_r )
           {
             setDirty(__FUNCTION__, repo_r->name );
-            ::repo_add_solv( repo_r , file_r  );
+            return ::repo_add_solv( repo_r , file_r  );
           }
           /** Adding Solvables to a repo. */
           detail::SolvableIdType _addSolvables( ::_Repo * repo_r, unsigned count_r )