AppChat  0.5.0
TCP client-server caht application with boost::asio library.
traced_exception.h
1 #ifndef TRACED_H
2 #define TRACED_H
3 
4 #include <boost/stacktrace.hpp>
5 #include <utility> // std::forward
6 
7 namespace util
8 {
9 
10 struct traced
11 {
12  virtual ~traced() {}
13  virtual const char* what() const noexcept = 0;
14 
15  const boost::stacktrace::stacktrace trace;
16 };
17 
18 template <class Exception>
19 struct with_trace : public Exception, public traced
20 {
21  template <class... Args>
22  with_trace(Args&&... args)
23  : Exception(std::forward<Args>(args)...)
24  { }
25 
26  virtual const char* what() const noexcept override { return Exception::what(); }
27 };
28 
29 } // namespace util
30 #endif // TRACED_H
Definition: traced_exception.h:7