11#ifndef SENZING_SDK_SZEXCEPTION_HPP
12#define SENZING_SDK_SZEXCEPTION_HPP
34 SzException(std::optional<int64_t> errorCode, std::string message)
43 SzException(std::optional<int64_t> errorCode, std::string message,
44 const std::exception& cause)
52 [[nodiscard]] std::optional<int64_t>
ErrorCode() const noexcept {
56 [[nodiscard]]
const char*
what() const noexcept
override {
68#define SENZING_SDK_DECLARE_EXCEPTION(Name, Base) \
69 class Name : public Base { \
72 explicit Name(std::string message) : Base(std::move(message)) {} \
73 Name(std::optional<int64_t> errorCode, std::string message) \
74 : Base(errorCode, std::move(message)) {} \
75 explicit Name(const std::exception& cause) : Base(cause) {} \
76 Name(std::string message, const std::exception& cause) \
77 : Base(std::move(message), cause) {} \
78 Name(std::optional<int64_t> errorCode, std::string message, \
79 const std::exception& cause) \
80 : Base(errorCode, std::move(message), cause) {} \
96 SzRetryableException);
98 SzRetryableException);
100 SzRetryableException);
106 SzUnrecoverableException);
109#undef SENZING_SDK_DECLARE_EXCEPTION
118 : std::logic_error(
"The Senzing environment has been destroyed.") {}
120 : std::logic_error(message) {}
125 const std::exception& cause)
126 : std::logic_error(message +
": " + cause.what()) {}
128 : std::logic_error(cause.what()) {}
#define SENZING_SDK_DECLARE_EXCEPTION(Name, Base)
Definition SzException.hpp:68
Thrown when an SzEnvironment (or a subsystem it owns) is used after Destroy().
Definition SzException.hpp:115
SzEnvironmentDestroyedException(const std::exception &cause)
Definition SzException.hpp:127
SzEnvironmentDestroyedException(const std::string &message)
Definition SzException.hpp:119
SzEnvironmentDestroyedException()
Definition SzException.hpp:117
SzEnvironmentDestroyedException(const std::string &message, const std::exception &cause)
Definition SzException.hpp:124
Base exception for all Senzing engine errors.
Definition SzException.hpp:27
std::string message_
Definition SzException.hpp:61
const char * what() const noexcept override
Definition SzException.hpp:56
SzException(std::string message)
Definition SzException.hpp:31
SzException(std::optional< int64_t > errorCode, std::string message, const std::exception &cause)
Definition SzException.hpp:43
SzException(std::string message, const std::exception &cause)
Definition SzException.hpp:40
SzException(const std::exception &cause)
Definition SzException.hpp:37
std::optional< int64_t > errorCode_
Definition SzException.hpp:62
~SzException() override=default
std::optional< int64_t > ErrorCode() const noexcept
The underlying Senzing error code, or std::nullopt if none was associated with this exception.
Definition SzException.hpp:52
SzException(std::optional< int64_t > errorCode, std::string message)
Definition SzException.hpp:34
Definition SzCoreConfig.hpp:20