Files
hack/bin/examples/exception/main.cpp
2025-09-19 00:39:21 +03:00

35 lines
683 B
C++

#include <vector>
#include "hack/exception/exception.hpp"
#include "hack/logger/logger.hpp"
auto main(int argc, char *argv[]) -> int
{
try
{
hack::exception e;
e.title("Test exception");
e.description("Super description for test exception");
e.service("example");
std::vector<int> vi = { 1, 2, 3 };
e.set("vector int", vi);
e.set("int", 1);
e.set("float", 1.13f);
e.set("double", 1.23);
e.set("file", std::filesystem::path("/tes/path/to_file.txt"));
throw e;
}
catch(hack::exception& e)
{
hack::log().no_info();
hack::error()(e);
hack::log()(e);
hack::log().reset();
}
hack::log().reset();
return 0;
}