dmlite  0.6
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 "dmlite/common/config.h"
8 #include "dmlite/common/errno.h"
9 
10 #include <cstdarg>
11 #include <exception>
12 #include <string>
13 
14 namespace dmlite {
15 
16 /// Base exception class
17 class DmException: public std::exception {
18 public:
19  DmException();
20  DmException(int code);
21  DmException(int code, const std::string &string);
22  DmException(int code, const char* fmt, va_list args);
23  DmException(int code, const char* fmt, ...);
24 
25  DmException(const DmException &de);
26 
27  virtual ~DmException() throw();
28 
29  int code() const throw();
30  const char* what() const throw();
31 
32  // reports an exception to the log
33  void report() const throw();
34 
35 protected:
37  std::string errorMsg_;
38  std::string stacktrace_;
39 
40  void setMessage(const char* fmt, va_list args);
41 };
42 
43 };
44 
45 #endif // DMLITE_CPP_EXCEPTIONS_H
Error codes.
void report() const
Base exception class.
Definition: exceptions.h:17
std::string stacktrace_
Definition: exceptions.h:38
int errorCode_
Definition: exceptions.h:36
void setMessage(const char *fmt, va_list args)
int code() const
const char * what() const
std::string errorMsg_
Definition: exceptions.h:37
virtual ~DmException()