Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

33 linhas
978B

  1. #include "./result.hpp"
  2. #include <dds/util/env.hpp>
  3. #include <dds/util/log.hpp>
  4. #include <fmt/ostream.h>
  5. #include <neo/sqlite3/error.hpp>
  6. #include <fstream>
  7. void dds::capture_exception() {
  8. try {
  9. throw;
  10. } catch (const neo::sqlite3::sqlite3_error& e) {
  11. current_error().load(e_sqlite3_error_exc{std::string(e.what()), e.code()},
  12. e.code(),
  13. neo::sqlite3::errc{e.code().value()});
  14. } catch (const std::system_error& e) {
  15. current_error().load(e_system_error_exc{std::string(e.what()), e.code()}, e.code());
  16. }
  17. // Re-throw as a bare exception.
  18. throw std::exception();
  19. }
  20. void dds::write_error_marker(std::string_view error) noexcept {
  21. dds_log(trace, "[error marker {}]", error);
  22. auto efile_path = dds::getenv("DDS_WRITE_ERROR_MARKER");
  23. if (efile_path) {
  24. std::ofstream outfile{*efile_path, std::ios::binary};
  25. fmt::print(outfile, "{}", error);
  26. }
  27. }