25 namespace diagnostics {
35 explicit UnilinkException(
const std::string& message,
const std::string& component =
"",
36 const std::string& operation =
"")
37 : std::runtime_error(message), component_(component), operation_(operation) {}
39 const std::string&
get_component() const noexcept {
return component_; }
40 const std::string&
get_operation() const noexcept {
return operation_; }
43 std::string full_msg = what();
44 if (!component_.empty()) {
45 full_msg =
"[" + component_ +
"] " + full_msg;
47 if (!operation_.empty()) {
48 full_msg +=
" (operation: " + operation_ +
")";
54 std::string component_;
55 std::string operation_;
66 explicit BuilderException(
const std::string& message,
const std::string& builder_type =
"",
67 const std::string& operation =
"")
68 :
UnilinkException(message,
"builder", operation), builder_type_(builder_type) {}
74 if (!builder_type_.empty()) {
75 full_msg =
"[" + builder_type_ +
"] " + full_msg;
81 std::string builder_type_;
93 const std::string& expected =
"")
94 :
UnilinkException(message,
"validation",
"validate"), parameter_(parameter), expected_(expected) {}
96 const std::string&
get_parameter() const noexcept {
return parameter_; }
97 const std::string&
get_expected() const noexcept {
return expected_; }
101 if (!parameter_.empty()) {
102 full_msg +=
" (parameter: " + parameter_ +
")";
104 if (!expected_.empty()) {
105 full_msg +=
" (expected: " + expected_ +
")";
111 std::string parameter_;
112 std::string expected_;
123 explicit MemoryException(
const std::string& message,
size_t size = 0,
const std::string& operation =
"")
149 const std::string& operation =
"")
150 :
UnilinkException(message,
"connection", operation), connection_type_(connection_type) {}
156 if (!connection_type_.empty()) {
157 full_msg =
"[" + connection_type_ +
"] " + full_msg;
163 std::string connection_type_;
175 const std::string& operation =
"")
176 :
UnilinkException(message,
"configuration", operation), config_section_(config_section) {}
182 if (!config_section_.empty()) {
183 full_msg +=
" (section: " + config_section_ +
")";
189 std::string config_section_;
Exception thrown during builder operations.
BuilderException(const std::string &message, const std::string &builder_type="", const std::string &operation="")
std::string get_full_message() const
const std::string & get_builder_type() const noexcept
Exception thrown during configuration operations.
const std::string & get_config_section() const noexcept
ConfigurationException(const std::string &message, const std::string &config_section="", const std::string &operation="")
std::string get_full_message() const
Exception thrown during connection operations.
ConnectionException(const std::string &message, const std::string &connection_type="", const std::string &operation="")
std::string get_full_message() const
const std::string & get_connection_type() const noexcept
Exception thrown during memory operations.
std::string get_full_message() const
MemoryException(const std::string &message, size_t size=0, const std::string &operation="")
size_t get_size() const noexcept
Base exception class for all unilink exceptions.
const std::string & get_operation() const noexcept
const std::string & get_component() const noexcept
std::string get_full_message() const
UnilinkException(const std::string &message, const std::string &component="", const std::string &operation="")
Exception thrown during input validation.
const std::string & get_parameter() const noexcept
const std::string & get_expected() const noexcept
ValidationException(const std::string &message, const std::string ¶meter="", const std::string &expected="")
std::string get_full_message() const
diagnostics::BuilderException BuilderException
diagnostics::ValidationException ValidationException
diagnostics::MemoryException MemoryException
diagnostics::ConfigurationException ConfigurationException
diagnostics::ConnectionException ConnectionException
diagnostics::UnilinkException UnilinkException
std::string to_string(ErrorCode code)
Convert ErrorCode to human-readable string.