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:
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 
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
Base exception class.
Definition: exceptions.h:17
virtual ~DmException()
DmException(int code, const char *fmt,...)
DmException(const DmException &de)
void setMessage(const char *fmt, va_list args)
std::string stacktrace_
Definition: exceptions.h:38
const char * what() const
void report() const
DmException(int code, const char *fmt, va_list args)
int errorCode_
Definition: exceptions.h:36
DmException(int code, const std::string &string)
std::string errorMsg_
Definition: exceptions.h:37
Error codes.
Namespace for the dmlite C++ API.
Definition: authn.h:16