00001
00002
00003
00004
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 {
00028 namespace rpm {
00030
00031
00035 class RpmException : public Exception
00036 {
00037 public:
00041 RpmException()
00042 : Exception( "Rpm Exception" )
00043 {}
00047 RpmException( const std::string & msg_r )
00048 : Exception( msg_r )
00049 {}
00051 virtual ~RpmException() throw() {};
00052 };
00053
00054 class GlobalRpmInitException : public RpmException
00055 {
00056 public:
00060 GlobalRpmInitException()
00061 : RpmException("Global RPM initialization failed")
00062 {}
00064 virtual ~GlobalRpmInitException() throw() {};
00065 private:
00066 };
00067
00068 class RpmInvalidRootException : public RpmException
00069 {
00070 public:
00074 RpmInvalidRootException( const Pathname & root_r,
00075 const Pathname & dbpath_r )
00076 : RpmException()
00077 , _root(root_r.asString())
00078 , _dbpath(dbpath_r.asString())
00079 {}
00081 virtual ~RpmInvalidRootException() throw() {};
00082 std::string root() const { return _root; }
00083 std::string dbpath() const { return _dbpath; }
00084 protected:
00085 virtual std::ostream & dumpOn( std::ostream & str ) const;
00086 private:
00087 std::string _root;
00088 std::string _dbpath;
00089 };
00090
00091 class RpmAccessBlockedException : public RpmException
00092 {
00093 public:
00094 RpmAccessBlockedException( const Pathname & root_r,
00095 const Pathname & dbpath_r )
00096 : RpmException()
00097 , _root(root_r.asString())
00098 , _dbpath(dbpath_r.asString())
00099 {}
00100 virtual ~RpmAccessBlockedException() throw() {};
00101 std::string root() const { return _root; }
00102 std::string dbpath() const { return _dbpath; }
00103 protected:
00104 virtual std::ostream & dumpOn( std::ostream & str ) const;
00105 private:
00106 std::string _root;
00107 std::string _dbpath;
00108 };
00109
00110 class RpmSubprocessException : public RpmException
00111 {
00112 public:
00113 RpmSubprocessException(const std::string & errmsg_r)
00114 : RpmException()
00115 , _errmsg(errmsg_r)
00116 {}
00117 virtual ~RpmSubprocessException() throw() {};
00118 protected:
00119 virtual std::ostream & dumpOn( std::ostream & str ) const;
00120 private:
00121 std::string _errmsg;
00122 };
00123
00124 class RpmInitException : public RpmException
00125 {
00126 public:
00127 RpmInitException(const Pathname & root_r,
00128 const Pathname & dbpath_r)
00129 : RpmException()
00130 , _root(root_r.asString())
00131 , _dbpath(dbpath_r.asString())
00132 {}
00133 virtual ~RpmInitException() throw() {};
00134 protected:
00135 virtual std::ostream & dumpOn( std::ostream & str ) const;
00136 private:
00137 std::string _root;
00138 std::string _dbpath;
00139 };
00140
00141 class RpmDbOpenException : public RpmException
00142 {
00143 public:
00144 RpmDbOpenException(const Pathname & root_r,
00145 const Pathname & dbpath_r)
00146 : RpmException()
00147 , _root(root_r.asString())
00148 , _dbpath(dbpath_r.asString())
00149 {}
00150 virtual ~RpmDbOpenException() throw() {};
00151 protected:
00152 virtual std::ostream & dumpOn( std::ostream & str ) const;
00153 private:
00154 std::string _root;
00155 std::string _dbpath;
00156 };
00157
00158 class RpmDbAlreadyOpenException : public RpmException
00159 {
00160 public:
00161 RpmDbAlreadyOpenException(const Pathname & old_root_r,
00162 const Pathname & old_dbpath_r,
00163 const Pathname & new_root_r,
00164 const Pathname & new_dbpath_r)
00165 : RpmException()
00166 , _old_root(old_root_r.asString())
00167 , _old_dbpath(old_dbpath_r.asString())
00168 , _new_root(new_root_r.asString())
00169 , _new_dbpath(new_dbpath_r.asString())
00170 {}
00171 virtual ~RpmDbAlreadyOpenException() throw() {};
00172 protected:
00173 virtual std::ostream & dumpOn( std::ostream & str ) const;
00174 private:
00175 std::string _old_root;
00176 std::string _old_dbpath;
00177 std::string _new_root;
00178 std::string _new_dbpath;
00179 };
00180
00181 class RpmDbNotOpenException : public RpmException
00182 {
00183 public:
00184 RpmDbNotOpenException()
00185 : RpmException()
00186 {}
00187 virtual ~RpmDbNotOpenException() throw() {};
00188 protected:
00189 virtual std::ostream & dumpOn( std::ostream & str ) const;
00190 private:
00191 };
00192
00193 class RpmDbConvertException : public RpmException
00194 {
00195 public:
00196 RpmDbConvertException()
00197 : RpmException()
00198 {}
00199 virtual ~RpmDbConvertException() throw() {};
00200 protected:
00201 virtual std::ostream & dumpOn( std::ostream & str ) const;
00202 private:
00203 };
00204
00205 class RpmNullDatabaseException : public RpmException
00206 {
00207 public:
00208 RpmNullDatabaseException()
00209 : RpmException()
00210 {}
00211 virtual ~RpmNullDatabaseException() throw() {};
00212 protected:
00213 virtual std::ostream & dumpOn( std::ostream & str ) const;
00214 private:
00215 };
00216
00217
00218
00220 }
00221 }
00222 }
00224 #endif // ZYPP_TARGET_RPM_RPMEXCEPTION_H