add exception

This commit is contained in:
2025-04-18 12:51:43 +03:00
parent 3f559432ba
commit e11b1d9f3c
3 changed files with 17 additions and 0 deletions

7
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,7 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
}

View File

@@ -9,6 +9,8 @@
#include "hack/patterns/ring_buffer.hpp"
#include "hack/patterns/identificator.hpp"
// #include "hack/security/uuid.hpp"
auto main(int argc, char *argv[]) -> int
{
// patterns::ring_buffer
@@ -26,6 +28,11 @@ auto main(int argc, char *argv[]) -> int
hack::log()(v);
}
// security
{
// hack::log()(hack::security::generate_uuid());
}
// patterns::identificator
{
struct a : public hack::patterns::identificator<>

View File

@@ -1,6 +1,7 @@
#pragma once
#include <experimental/source_location>
#include <any>
#include "hack/utils/color.hpp"
#include "hack/exception/title.hpp"
@@ -22,6 +23,7 @@ namespace hack
void system_error(const std::exception& e) noexcept { m_system_error = e.what(); }
void title(const std::string v) noexcept { m_title = v; }
void description(const std::string v) noexcept { m_description = v; }
void set_data(std::any v) noexcept { m_data = v; }
void log()
{
@@ -52,5 +54,6 @@ namespace hack
std::string m_title { exception_title::NO_VALID_DATA };
std::string m_description;
std::experimental::source_location m_location;
std::any m_data;
};
}