libzypp  17.32.5
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 #include <utility>
19 
20 #include <zypp/base/Exception.h>
21 #include <zypp/Pathname.h>
22 #include <zypp/Url.h>
23 
25 namespace zypp
26 {
27 namespace target
28 {
30 namespace rpm
31 {
33 //
34 // CLASS NAME : RpmException
38 class RpmException : public Exception
39 {
40 public:
45  : Exception( "Rpm Exception" )
46  {}
50  RpmException( const std::string & msg_r )
51  : Exception( msg_r )
52  {}
54  ~RpmException() throw() override
55  {};
56 };
57 
59 {
60 public:
65  : RpmException("Global RPM initialization failed")
66  {}
68  ~GlobalRpmInitException() throw() override
69  {};
70 private:
71 };
72 
74 {
75 public:
80  const Pathname & dbpath_r )
81  : RpmException()
82  , _root(root_r.asString())
83  , _dbpath(dbpath_r.asString())
84  {}
86  ~RpmInvalidRootException() throw() override
87  {};
88  std::string root() const
89  {
90  return _root;
91  }
92  std::string dbpath() const
93  {
94  return _dbpath;
95  }
96 protected:
97  std::ostream & dumpOn( std::ostream & str ) const override;
98 private:
99  std::string _root;
100  std::string _dbpath;
101 };
102 
104 {
105 public:
107  const Pathname & dbpath_r )
108  : RpmException()
109  , _root(root_r.asString())
110  , _dbpath(dbpath_r.asString())
111  {}
112  ~RpmAccessBlockedException() throw() override
113  {};
114  std::string root() const
115  {
116  return _root;
117  }
118  std::string dbpath() const
119  {
120  return _dbpath;
121  }
122 protected:
123  std::ostream & dumpOn( std::ostream & str ) const override;
124 private:
125  std::string _root;
126  std::string _dbpath;
127 };
128 
130 {
131 public:
132  RpmSubprocessException(std::string errmsg_r)
133  : RpmException()
134  , _errmsg(std::move(errmsg_r))
135  {}
136  ~RpmSubprocessException() throw() override
137  {};
138 protected:
139  std::ostream & dumpOn( std::ostream & str ) const override;
140 private:
141  std::string _errmsg;
142 };
143 
145 {
146 public:
147  RpmInitException(const Pathname & root_r,
148  const Pathname & dbpath_r)
149  : RpmException()
150  , _root(root_r.asString())
151  , _dbpath(dbpath_r.asString())
152  {}
153  ~RpmInitException() throw() override
154  {};
155 protected:
156  std::ostream & dumpOn( std::ostream & str ) const override;
157 private:
158  std::string _root;
159  std::string _dbpath;
160 };
161 
163 {
164 public:
165  RpmDbOpenException(const Pathname & root_r,
166  const Pathname & dbpath_r)
167  : RpmException()
168  , _root(root_r.asString())
169  , _dbpath(dbpath_r.asString())
170  {}
171  ~RpmDbOpenException() throw() override
172  {};
173 protected:
174  std::ostream & dumpOn( std::ostream & str ) const override;
175 private:
176  std::string _root;
177  std::string _dbpath;
178 };
179 
181 {
182 public:
184  const Pathname & old_dbpath_r,
185  const Pathname & new_root_r,
186  const Pathname & new_dbpath_r)
187  : RpmException()
188  , _old_root(old_root_r.asString())
189  , _old_dbpath(old_dbpath_r.asString())
190  , _new_root(new_root_r.asString())
191  , _new_dbpath(new_dbpath_r.asString())
192  {}
193  ~RpmDbAlreadyOpenException() throw() override
194  {};
195 protected:
196  std::ostream & dumpOn( std::ostream & str ) const override;
197 private:
198  std::string _old_root;
199  std::string _old_dbpath;
200  std::string _new_root;
201  std::string _new_dbpath;
202 };
203 
205 {
206 public:
208  : RpmException()
209  {}
210  ~RpmDbNotOpenException() throw() override
211  {};
212 protected:
213  std::ostream & dumpOn( std::ostream & str ) const override;
214 private:
215 };
216 
218 {
219 public:
221  : RpmException()
222  {}
223  ~RpmDbConvertException() throw() override
224  {};
225 protected:
226  std::ostream & dumpOn( std::ostream & str ) const override;
227 private:
228 };
229 
231 {
232 public:
234  : RpmException()
235  {}
236  ~RpmNullDatabaseException() throw() override
237  {};
238 protected:
239  std::ostream & dumpOn( std::ostream & str ) const override;
240 private:
241 };
242 
244 {
245 public:
246  RpmTransactionFailedException(std::string errmsg_r)
247  : RpmException()
248  , _errmsg(std::move(errmsg_r))
249  {}
251  {};
252 protected:
253  std::ostream & dumpOn( std::ostream & str ) const override;
254 private:
255  std::string _errmsg;
256 };
257 
258 
259 
261 } // namespace rpm
262 } // namespace target
263 } // namespace zypp
265 #endif // ZYPP_TARGET_RPM_RPMEXCEPTION_H
RpmInvalidRootException(const Pathname &root_r, const Pathname &dbpath_r)
Ctor taking message.
Definition: RpmException.h:79
GlobalRpmInitException()
Ctor taking message.
Definition: RpmException.h:64
std::ostream & dumpOn(std::ostream &str) const override
Overload this to print a proper error message.
Definition: RpmException.cc:57
String related utilities and Regular expression matching.
Definition: Arch.h:363
RpmSubprocessException(std::string errmsg_r)
Definition: RpmException.h:132
std::ostream & dumpOn(std::ostream &str) const override
Overload this to print a proper error message.
Definition: RpmException.cc:63
~RpmException() override
Dtor.
Definition: RpmException.h:54
RpmInitException(const Pathname &root_r, const Pathname &dbpath_r)
Definition: RpmException.h:147
std::ostream & dumpOn(std::ostream &str) const override
Overload this to print a proper error message.
Definition: RpmException.cc:28
std::ostream & dumpOn(std::ostream &str) const override
Overload this to print a proper error message.
Definition: RpmException.cc:73
std::string asString() const
Error message provided by dumpOn as string.
Definition: Exception.cc:94
std::ostream & dumpOn(std::ostream &str) const override
Overload this to print a proper error message.
Definition: RpmException.cc:51
std::ostream & dumpOn(std::ostream &str) const override
Overload this to print a proper error message.
Definition: RpmException.cc:40
std::ostream & dumpOn(std::ostream &str) const override
Overload this to print a proper error message.
Definition: RpmException.cc:34
Just inherits Exception to separate media exceptions.
Definition: RpmException.h:38
Base class for Exception.
Definition: Exception.h:146
RpmException(const std::string &msg_r)
Ctor taking message.
Definition: RpmException.h:50
RpmDbOpenException(const Pathname &root_r, const Pathname &dbpath_r)
Definition: RpmException.h:165
RpmException()
Ctor taking message.
Definition: RpmException.h:44
RpmAccessBlockedException(const Pathname &root_r, const Pathname &dbpath_r)
Definition: RpmException.h:106
std::ostream & dumpOn(std::ostream &str) const override
Overload this to print a proper error message.
Definition: RpmException.cc:45
Easy-to use interface to the ZYPP dependency resolver.
Definition: Application.cc:19
std::ostream & dumpOn(std::ostream &str) const override
Overload this to print a proper error message.
Definition: RpmException.cc:68
RpmDbAlreadyOpenException(const Pathname &old_root_r, const Pathname &old_dbpath_r, const Pathname &new_root_r, const Pathname &new_dbpath_r)
Definition: RpmException.h:183
std::ostream & dumpOn(std::ostream &str) const override
Overload this to print a proper error message.
Definition: RpmException.cc:78