libzypp  13.10.6
RpmException.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_TARGET_RPM_RPMEXCEPTION_H
13 #define ZYPP_TARGET_RPM_RPMEXCEPTION_H
14 
15 #include <iosfwd>
16 
17 #include <string>
18 
19 #include "zypp/base/Exception.h"
20 #include "zypp/Pathname.h"
21 #include "zypp/Url.h"
22 
24 namespace zypp
25 {
26 namespace target
27 {
29 namespace rpm
30 {
32 //
33 // CLASS NAME : RpmException
37 class RpmException : public Exception
38 {
39 public:
44  : Exception( "Rpm Exception" )
45  {}
49  RpmException( const std::string & msg_r )
50  : Exception( msg_r )
51  {}
53  virtual ~RpmException() throw()
54  {};
55 };
56 
58 {
59 public:
64  : RpmException("Global RPM initialization failed")
65  {}
67  virtual ~GlobalRpmInitException() throw()
68  {};
69 private:
70 };
71 
73 {
74 public:
78  RpmInvalidRootException( const Pathname & root_r,
79  const Pathname & dbpath_r )
80  : RpmException()
81  , _root(root_r.asString())
82  , _dbpath(dbpath_r.asString())
83  {}
85  virtual ~RpmInvalidRootException() throw()
86  {};
87  std::string root() const
88  {
89  return _root;
90  }
91  std::string dbpath() const
92  {
93  return _dbpath;
94  }
95 protected:
96  virtual std::ostream & dumpOn( std::ostream & str ) const;
97 private:
98  std::string _root;
99  std::string _dbpath;
100 };
101 
103 {
104 public:
105  RpmAccessBlockedException( const Pathname & root_r,
106  const Pathname & dbpath_r )
107  : RpmException()
108  , _root(root_r.asString())
109  , _dbpath(dbpath_r.asString())
110  {}
111  virtual ~RpmAccessBlockedException() throw()
112  {};
113  std::string root() const
114  {
115  return _root;
116  }
117  std::string dbpath() const
118  {
119  return _dbpath;
120  }
121 protected:
122  virtual std::ostream & dumpOn( std::ostream & str ) const;
123 private:
124  std::string _root;
125  std::string _dbpath;
126 };
127 
129 {
130 public:
131  RpmSubprocessException(const std::string & errmsg_r)
132  : RpmException()
133  , _errmsg(errmsg_r)
134  {}
135  virtual ~RpmSubprocessException() throw()
136  {};
137 protected:
138  virtual std::ostream & dumpOn( std::ostream & str ) const;
139 private:
140  std::string _errmsg;
141 };
142 
144 {
145 public:
146  RpmInitException(const Pathname & root_r,
147  const Pathname & dbpath_r)
148  : RpmException()
149  , _root(root_r.asString())
150  , _dbpath(dbpath_r.asString())
151  {}
152  virtual ~RpmInitException() throw()
153  {};
154 protected:
155  virtual std::ostream & dumpOn( std::ostream & str ) const;
156 private:
157  std::string _root;
158  std::string _dbpath;
159 };
160 
162 {
163 public:
164  RpmDbOpenException(const Pathname & root_r,
165  const Pathname & dbpath_r)
166  : RpmException()
167  , _root(root_r.asString())
168  , _dbpath(dbpath_r.asString())
169  {}
170  virtual ~RpmDbOpenException() throw()
171  {};
172 protected:
173  virtual std::ostream & dumpOn( std::ostream & str ) const;
174 private:
175  std::string _root;
176  std::string _dbpath;
177 };
178 
180 {
181 public:
182  RpmDbAlreadyOpenException(const Pathname & old_root_r,
183  const Pathname & old_dbpath_r,
184  const Pathname & new_root_r,
185  const Pathname & new_dbpath_r)
186  : RpmException()
187  , _old_root(old_root_r.asString())
188  , _old_dbpath(old_dbpath_r.asString())
189  , _new_root(new_root_r.asString())
190  , _new_dbpath(new_dbpath_r.asString())
191  {}
192  virtual ~RpmDbAlreadyOpenException() throw()
193  {};
194 protected:
195  virtual std::ostream & dumpOn( std::ostream & str ) const;
196 private:
197  std::string _old_root;
198  std::string _old_dbpath;
199  std::string _new_root;
200  std::string _new_dbpath;
201 };
202 
204 {
205 public:
207  : RpmException()
208  {}
209  virtual ~RpmDbNotOpenException() throw()
210  {};
211 protected:
212  virtual std::ostream & dumpOn( std::ostream & str ) const;
213 private:
214 };
215 
217 {
218 public:
220  : RpmException()
221  {}
222  virtual ~RpmDbConvertException() throw()
223  {};
224 protected:
225  virtual std::ostream & dumpOn( std::ostream & str ) const;
226 private:
227 };
228 
230 {
231 public:
233  : RpmException()
234  {}
235  virtual ~RpmNullDatabaseException() throw()
236  {};
237 protected:
238  virtual std::ostream & dumpOn( std::ostream & str ) const;
239 private:
240 };
241 
242 
243 
245 } // namespace rpm
246 } // namespace target
247 } // namespace zypp
249 #endif // ZYPP_TARGET_RPM_RPMEXCEPTION_H
virtual std::ostream & dumpOn(std::ostream &str) const
Overload this to print a proper error message.
Definition: RpmException.cc:70
virtual std::ostream & dumpOn(std::ostream &str) const
Overload this to print a proper error message.
Definition: RpmException.cc:30
RpmInvalidRootException(const Pathname &root_r, const Pathname &dbpath_r)
Ctor taking message.
Definition: RpmException.h:78
GlobalRpmInitException()
Ctor taking message.
Definition: RpmException.h:63
virtual std::ostream & dumpOn(std::ostream &str) const
Overload this to print a proper error message.
Definition: RpmException.cc:75
virtual std::ostream & dumpOn(std::ostream &str) const
Overload this to print a proper error message.
Definition: RpmException.cc:47
virtual std::ostream & dumpOn(std::ostream &str) const
Overload this to print a proper error message.
Definition: RpmException.cc:53
RpmInitException(const Pathname &root_r, const Pathname &dbpath_r)
Definition: RpmException.h:146
std::string asString() const
Error message provided by dumpOn as string.
Definition: Exception.cc:59
virtual std::ostream & dumpOn(std::ostream &str) const
Overload this to print a proper error message.
Definition: RpmException.cc:59
Just inherits Exception to separate media exceptions.
Definition: RpmException.h:37
virtual std::ostream & dumpOn(std::ostream &str) const
Overload this to print a proper error message.
Definition: RpmException.cc:36
virtual std::ostream & dumpOn(std::ostream &str) const
Overload this to print a proper error message.
Definition: RpmException.cc:65
Base class for Exception.
Definition: Exception.h:143
RpmException(const std::string &msg_r)
Ctor taking message.
Definition: RpmException.h:49
RpmDbOpenException(const Pathname &root_r, const Pathname &dbpath_r)
Definition: RpmException.h:164
RpmException()
Ctor taking message.
Definition: RpmException.h:43
RpmAccessBlockedException(const Pathname &root_r, const Pathname &dbpath_r)
Definition: RpmException.h:105
virtual std::ostream & dumpOn(std::ostream &str) const
Overload this to print a proper error message.
Definition: RpmException.cc:42
RpmDbAlreadyOpenException(const Pathname &old_root_r, const Pathname &old_dbpath_r, const Pathname &new_root_r, const Pathname &new_dbpath_r)
Definition: RpmException.h:182
RpmSubprocessException(const std::string &errmsg_r)
Definition: RpmException.h:131