bt_exception.h 425 B

123456789101112131415161718192021222324
  1. #pragma once
  2. #include <utility>
  3. #include "yexception.h"
  4. #include <util/system/backtrace.h>
  5. template <class T>
  6. class TWithBackTrace: public T {
  7. public:
  8. template <typename... Args>
  9. inline TWithBackTrace(Args&&... args)
  10. : T(std::forward<Args>(args)...)
  11. {
  12. BT_.Capture();
  13. }
  14. const TBackTrace* BackTrace() const noexcept override {
  15. return &BT_;
  16. }
  17. private:
  18. TBackTrace BT_;
  19. };