dmlite  0.4
exceptions.h
Go to the documentation of this file.
1 /// @file include/dmlite/cpp/exceptions.h
2 /// @brief Exceptions used by the API
3 /// @author Alejandro Álvarez Ayllón <aalvarez@cern.ch>
4 #ifndef DMLITE_CPP_EXCEPTIONS_H
5 #define DMLITE_CPP_EXCEPTIONS_H
6 
7 #include <cstdarg>
8 #include <exception>
9 #include <string>
10 #include "../common/errno.h"
11 
12 namespace dmlite {
13 
14 /// Base exception class
15 class DmException: public std::exception {
16 public:
17  DmException();
18  DmException(int code);
19  DmException(int code, const std::string &string);
20  DmException(int code, const char* fmt, va_list args);
21  DmException(int code, const char* fmt, ...);
22 
23  DmException(const DmException &de);
24 
25  virtual ~DmException() throw();
26 
27  int code() const throw();
28  const char* what() const throw();
29 
30 protected:
32  std::string errorMsg_;
33 
34  void setMessage(const char* fmt, va_list args);
35 };
36 
37 };
38 
39 #endif // DMLITE_CPP_EXCEPTIONS_H