MCPcopy Create free account
hub / github.com/catboost/catboost / FormatCurrentExceptionTo

Function FormatCurrentExceptionTo

util/generic/yexception.cpp:62–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62void FormatCurrentExceptionTo(IOutputStream& out) {
63 auto exceptionPtr = std::current_exception();
64
65 if (Y_UNLIKELY(!exceptionPtr)) {
66 out << "(NO EXCEPTION)\n";
67 return;
68 }
69
70#ifdef _YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE
71 TBackTrace backtrace = TBackTrace::FromCurrentException();
72#endif
73 try {
74 std::rethrow_exception(exceptionPtr);
75 } catch (const std::exception& e) {
76 out << "Caught:\n";
77 FormatExceptionTo(out, e);
78 out << "\n";
79#ifdef _YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE
80 FormatBackTraceTo(out, backtrace);
81#endif
82 return;
83 } catch (...) {
84 out << "unknown error\n";
85 return;
86 }
87}
88
89TString FormatCurrentException() {
90 TStringStream out;

Callers 1

FormatCurrentExceptionFunction · 0.85

Calls 2

FormatExceptionToFunction · 0.85
FormatBackTraceToFunction · 0.85

Tested by

no test coverage detected