Commit fbb8244f authored by Gabi Melman's avatar Gabi Melman Committed by GitHub

Merge pull request #533 from manuel-schiller/patch-1

rethrow unwind exception
parents 69e6af0b 039b34e8
...@@ -42,6 +42,12 @@ ...@@ -42,6 +42,12 @@
#define SPDLOG_DEPRECATED #define SPDLOG_DEPRECATED
#endif #endif
#ifdef __linux__
#include <cxxabi.h>
#define SPDLOG_CATCH_ALL catch (abi::__forced_unwind&) { _err_handler("Unknown exception"); throw; } catch (...)
#else // __linux__
#define SPDLOG_CATCH_ALL catch (...)
#endif // __linux__
#include "spdlog/fmt/fmt.h" #include "spdlog/fmt/fmt.h"
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <memory> #include <memory>
#include <string> #include <string>
// create logger with given name, sinks and the default pattern formatter // create logger with given name, sinks and the default pattern formatter
// all other ctors will call this one // all other ctors will call this one
template<class It> template<class It>
...@@ -78,7 +77,7 @@ inline void spdlog::logger::log(level::level_enum lvl, const char* fmt, const Ar ...@@ -78,7 +77,7 @@ inline void spdlog::logger::log(level::level_enum lvl, const char* fmt, const Ar
{ {
_err_handler(ex.what()); _err_handler(ex.what());
} }
catch (...) SPDLOG_CATCH_ALL
{ {
_err_handler("Unknown exception"); _err_handler("Unknown exception");
} }
...@@ -98,7 +97,7 @@ inline void spdlog::logger::log(level::level_enum lvl, const char* msg) ...@@ -98,7 +97,7 @@ inline void spdlog::logger::log(level::level_enum lvl, const char* msg)
{ {
_err_handler(ex.what()); _err_handler(ex.what());
} }
catch (...) SPDLOG_CATCH_ALL
{ {
_err_handler("Unknown exception"); _err_handler("Unknown exception");
} }
...@@ -119,7 +118,7 @@ inline void spdlog::logger::log(level::level_enum lvl, const T& msg) ...@@ -119,7 +118,7 @@ inline void spdlog::logger::log(level::level_enum lvl, const T& msg)
{ {
_err_handler(ex.what()); _err_handler(ex.what());
} }
catch (...) SPDLOG_CATCH_ALL
{ {
_err_handler("Unknown exception"); _err_handler("Unknown exception");
} }
...@@ -571,3 +570,5 @@ inline const std::vector<spdlog::sink_ptr>& spdlog::logger::sinks() const ...@@ -571,3 +570,5 @@ inline const std::vector<spdlog::sink_ptr>& spdlog::logger::sinks() const
{ {
return _sinks; return _sinks;
} }
#undef SPDLOG_CATCH_ALL
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment