utils.cpp 482 B

12345678910111213141516171819202122232425
  1. #include "config.h"
  2. #include "utils.h"
  3. #include <cassert>
  4. #include <exception>
  5. #include "core/logging.h"
  6. void eax_log_exception(std::string_view message) noexcept
  7. {
  8. const auto exception_ptr = std::current_exception();
  9. assert(exception_ptr);
  10. try {
  11. std::rethrow_exception(exception_ptr);
  12. }
  13. catch(const std::exception& ex) {
  14. ERR("{} {}", message, ex.what());
  15. }
  16. catch(...) {
  17. ERR("{} {}", message, "Generic exception.");
  18. }
  19. }