libzypp
10.5.0
|
00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #ifndef ZYPP_TARGET_RPM_RPMEXCEPTION_H 00013 #define ZYPP_TARGET_RPM_RPMEXCEPTION_H 00014 00015 #include <iosfwd> 00016 00017 #include <string> 00018 00019 #include "zypp/base/Exception.h" 00020 #include "zypp/Pathname.h" 00021 #include "zypp/Url.h" 00022 00024 namespace zypp 00025 { 00026 namespace target 00027 { 00029 namespace rpm 00030 { 00032 // 00033 // CLASS NAME : RpmException 00037 class RpmException : public Exception 00038 { 00039 public: 00043 RpmException() 00044 : Exception( "Rpm Exception" ) 00045 {} 00049 RpmException( const std::string & msg_r ) 00050 : Exception( msg_r ) 00051 {} 00053 virtual ~RpmException() throw() 00054 {}; 00055 }; 00056 00057 class GlobalRpmInitException : public RpmException 00058 { 00059 public: 00063 GlobalRpmInitException() 00064 : RpmException("Global RPM initialization failed") 00065 {} 00067 virtual ~GlobalRpmInitException() throw() 00068 {}; 00069 private: 00070 }; 00071 00072 class RpmInvalidRootException : public RpmException 00073 { 00074 public: 00078 RpmInvalidRootException( const Pathname & root_r, 00079 const Pathname & dbpath_r ) 00080 : RpmException() 00081 , _root(root_r.asString()) 00082 , _dbpath(dbpath_r.asString()) 00083 {} 00085 virtual ~RpmInvalidRootException() throw() 00086 {}; 00087 std::string root() const 00088 { 00089 return _root; 00090 } 00091 std::string dbpath() const 00092 { 00093 return _dbpath; 00094 } 00095 protected: 00096 virtual std::ostream & dumpOn( std::ostream & str ) const; 00097 private: 00098 std::string _root; 00099 std::string _dbpath; 00100 }; 00101 00102 class RpmAccessBlockedException : public RpmException 00103 { 00104 public: 00105 RpmAccessBlockedException( const Pathname & root_r, 00106 const Pathname & dbpath_r ) 00107 : RpmException() 00108 , _root(root_r.asString()) 00109 , _dbpath(dbpath_r.asString()) 00110 {} 00111 virtual ~RpmAccessBlockedException() throw() 00112 {}; 00113 std::string root() const 00114 { 00115 return _root; 00116 } 00117 std::string dbpath() const 00118 { 00119 return _dbpath; 00120 } 00121 protected: 00122 virtual std::ostream & dumpOn( std::ostream & str ) const; 00123 private: 00124 std::string _root; 00125 std::string _dbpath; 00126 }; 00127 00128 class RpmSubprocessException : public RpmException 00129 { 00130 public: 00131 RpmSubprocessException(const std::string & errmsg_r) 00132 : RpmException() 00133 , _errmsg(errmsg_r) 00134 {} 00135 virtual ~RpmSubprocessException() throw() 00136 {}; 00137 protected: 00138 virtual std::ostream & dumpOn( std::ostream & str ) const; 00139 private: 00140 std::string _errmsg; 00141 }; 00142 00143 class RpmInitException : public RpmException 00144 { 00145 public: 00146 RpmInitException(const Pathname & root_r, 00147 const Pathname & dbpath_r) 00148 : RpmException() 00149 , _root(root_r.asString()) 00150 , _dbpath(dbpath_r.asString()) 00151 {} 00152 virtual ~RpmInitException() throw() 00153 {}; 00154 protected: 00155 virtual std::ostream & dumpOn( std::ostream & str ) const; 00156 private: 00157 std::string _root; 00158 std::string _dbpath; 00159 }; 00160 00161 class RpmDbOpenException : public RpmException 00162 { 00163 public: 00164 RpmDbOpenException(const Pathname & root_r, 00165 const Pathname & dbpath_r) 00166 : RpmException() 00167 , _root(root_r.asString()) 00168 , _dbpath(dbpath_r.asString()) 00169 {} 00170 virtual ~RpmDbOpenException() throw() 00171 {}; 00172 protected: 00173 virtual std::ostream & dumpOn( std::ostream & str ) const; 00174 private: 00175 std::string _root; 00176 std::string _dbpath; 00177 }; 00178 00179 class RpmDbAlreadyOpenException : public RpmException 00180 { 00181 public: 00182 RpmDbAlreadyOpenException(const Pathname & old_root_r, 00183 const Pathname & old_dbpath_r, 00184 const Pathname & new_root_r, 00185 const Pathname & new_dbpath_r) 00186 : RpmException() 00187 , _old_root(old_root_r.asString()) 00188 , _old_dbpath(old_dbpath_r.asString()) 00189 , _new_root(new_root_r.asString()) 00190 , _new_dbpath(new_dbpath_r.asString()) 00191 {} 00192 virtual ~RpmDbAlreadyOpenException() throw() 00193 {}; 00194 protected: 00195 virtual std::ostream & dumpOn( std::ostream & str ) const; 00196 private: 00197 std::string _old_root; 00198 std::string _old_dbpath; 00199 std::string _new_root; 00200 std::string _new_dbpath; 00201 }; 00202 00203 class RpmDbNotOpenException : public RpmException 00204 { 00205 public: 00206 RpmDbNotOpenException() 00207 : RpmException() 00208 {} 00209 virtual ~RpmDbNotOpenException() throw() 00210 {}; 00211 protected: 00212 virtual std::ostream & dumpOn( std::ostream & str ) const; 00213 private: 00214 }; 00215 00216 class RpmDbConvertException : public RpmException 00217 { 00218 public: 00219 RpmDbConvertException() 00220 : RpmException() 00221 {} 00222 virtual ~RpmDbConvertException() throw() 00223 {}; 00224 protected: 00225 virtual std::ostream & dumpOn( std::ostream & str ) const; 00226 private: 00227 }; 00228 00229 class RpmNullDatabaseException : public RpmException 00230 { 00231 public: 00232 RpmNullDatabaseException() 00233 : RpmException() 00234 {} 00235 virtual ~RpmNullDatabaseException() throw() 00236 {}; 00237 protected: 00238 virtual std::ostream & dumpOn( std::ostream & str ) const; 00239 private: 00240 }; 00241 00242 00243 00245 } // namespace rpm 00246 } // namespace target 00247 } // namespace zypp 00249 #endif // ZYPP_TARGET_RPM_RPMEXCEPTION_H