/
uzer_007
/
reindexer
Обзор
Документация
Войти
/
uzer_007
/
reindexer
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
cpp_src/tools/errors.cc
28 строк
1 KB
madschemas
Update to version v5.3.0
27 май 2025, 09:19
27 май 2025, 09:19
df43703
Код
Авторство
О чём код?
#include "errors.h" #include <iostream> #include "debug/backtrace.h" namespace reindexer { // NOLINTNEXTLINE(bugprone-exception-escape) Exception does not matter here - we are going to crash anyway void print_backtrace_and_abort(const char* assertion, const char* file, unsigned int line, std::string_view description) noexcept { auto msg = fmt::format("{}:{}: failed assertion '{}':\n{}", file, line, assertion, description); std::cerr << msg << "\n"; reindexer::debug::print_backtrace(std::cerr, nullptr, -1); reindexer::debug::print_crash_query(std::cerr); reindexer::debug::backtrace_set_assertion_message(std::move(assertion)); abort(); } void print_backtrace_and_abort(const char* assertion, const char* file, unsigned int line) noexcept { constexpr static auto kEmptyDescription = "No additional description"; print_backtrace_and_abort(assertion, file, line, kEmptyDescription); } const Error::WhatPtr Error::defaultErrorText_{make_intrusive<Error::WhatT>("Error text generation failed")}; std::ostream& operator<<(std::ostream& os, const Error& error) { return os << "{ code: " << error.code() << "; what: \"" << error.what() << "\"}"; } } // namespace reindexer