*
* @ingroup XBT_ex
*/
-XBT_PUBLIC void logException(e_xbt_log_priority_t priority, const char* context, std::exception const& exception);
+XBT_PUBLIC void log_exception(e_xbt_log_priority_t priority, const char* context, std::exception const& exception);
-XBT_PUBLIC void installExceptionHandler();
+XBT_PUBLIC void install_exception_handler();
+
+// deprecated
+XBT_ATTRIB_DEPRECATED_v323("xbt::log_exception()") XBT_PUBLIC
+ void logException(e_xbt_log_priority_t priority, const char* context, std::exception const& exception);
+XBT_ATTRIB_DEPRECATED_v323("xbt::install_exception_handler()") XBT_PUBLIC void installExceptionHandler();
}
}
/** @brief shows an exception content and the associated stack if available */
void xbt_ex_display(xbt_ex_t * e)
{
- simgrid::xbt::logException(xbt_log_priority_critical, "UNCAUGHT EXCEPTION", *e);
+ simgrid::xbt::log_exception(xbt_log_priority_critical, "UNCAUGHT EXCEPTION", *e);
}
/** \brief returns a short name for the given exception category */
WithContextException::~WithContextException() = default;
-void logException(
- e_xbt_log_priority_t prio,
- const char* context, std::exception const& exception)
+void log_exception(e_xbt_log_priority_t prio, const char* context, std::exception const& exception)
{
try {
auto name = simgrid::xbt::demangle(typeid(exception).name());
with_nested->rethrow_nested();
}
catch (std::exception& nested_exception) {
- logException(prio, "Caused by", nested_exception);
+ log_exception(prio, "Caused by", nested_exception);
}
// We could catch nested_exception or WithContextException but we don't bother:
catch (...) {
// We manage C++ exception ourselves
catch (std::exception& e) {
- logException(xbt_log_priority_critical, "Uncaught exception", e);
+ log_exception(xbt_log_priority_critical, "Uncaught exception", e);
showBacktrace(bt);
std::abort();
}
}
-void installExceptionHandler()
+void install_exception_handler()
{
static std::once_flag handler_flag;
std::call_once(handler_flag, [] {
previous_terminate_handler = std::set_terminate(handler);
});
}
-
+// deprecated
+void logException(e_xbt_log_priority_t priority, const char* context, std::exception const& exception)
+{
+ log_exception(priority, context, exception);
}
+void installExceptionHandler()
+{
+ install_exception_handler();
+}
+
+} // namespace xbt
}