libzypp  13.10.6
HalException.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
13 #ifndef ZYPP_TARGET_HAL_HALEXCEPTION_H
14 #define ZYPP_TARGET_HAL_HALEXCEPTION_H
15 
16 #include "zypp/base/Exception.h"
17 #include "zypp/base/Gettext.h"
18 #include "zypp/base/String.h"
19 
20 
22 namespace zypp
23 {
24  namespace target
26  {
27  namespace hal
29  {
30 
31 
33  //
34  // CLASS NAME : HalException
35  //
40  {
41  public:
46  : zypp::Exception(_("Hal Exception"))
47  {}
48 
54  HalException(const std::string &msg_r)
55  : zypp::Exception(_("Hal Exception"))
56  , e_name()
57  , e_msg(msg_r)
58  {}
59 
63  HalException(const std::string &err_name, const std::string &err_msg)
64  : zypp::Exception(_("Hal Exception"))
65  , e_name(err_name)
66  , e_msg(err_msg)
67  {}
68 
71  virtual ~HalException() throw() {};
72 
76  const std::string & errorName() const
77  {
78  return e_name;
79  }
80 
84  const std::string & errorMessage() const
85  {
86  return e_msg;
87  }
88 
89  protected:
90  virtual std::ostream & dumpOn( std::ostream & str ) const;
91 
92  private:
93  std::string e_name;
94  std::string e_msg;
95  };
96 
99  struct NoHalException: public Exception
100  { NoHalException(); };
101 
103  } // namespace hal
106  } // namespace target
109 } // namespace zypp
111 
112 #endif // ZYPP_TARGET_HAL_HALEXCEPTION_H
113 
114 /*
115 ** vim: set ts=2 sts=2 sw=2 ai et:
116 */
const std::string & errorMessage() const
Definition: HalException.h:84
Interface to gettext.
virtual std::ostream & dumpOn(std::ostream &str) const
Overload this to print a proper error message.
Definition: HalContext.cc:147
Exception thrown if we were built without hal support (-DNO_HAL).
Definition: HalException.h:99
HalException(const std::string &msg_r)
Constructor taking complete hal error message.
Definition: HalException.h:54
Hardware abstaction layer exception.
Definition: HalException.h:39
virtual ~HalException()
Destructor.
Definition: HalException.h:71
HalException()
Default constructor.
Definition: HalException.h:45
#define _(MSG)
Return translated text.
Definition: Gettext.h:21
Base class for Exception.
Definition: Exception.h:143
const std::string & errorName() const
Definition: HalException.h:76
HalException(const std::string &err_name, const std::string &err_msg)
Constructor taking HAL (DBUS) error message components.
Definition: HalException.h:63