|
- #pragma once
-
- #include <cppcore/misc/exception.h>
-
- #include <cppmariadb/config.h>
- #include <cppmariadb/enums.h>
-
- namespace cppmariadb
- {
-
- /**
- * @brief Exception class used for all mariadb errors.
- */
- struct exception
- : public ::cppcore::exception
- {
- public:
- error_code error; //!< Error code.
- std::string query; //!< Erroneous query.
-
- public:
- /**
- * @brief Constructor. Create an exception object.
- *
- * @param[in] msg Exception message.
- * @param[in] err Error code.
- * @param[in] q Erroneous query.
- */
- inline exception(
- const std::string& msg,
- error_code err,
- const std::string& q = std::string());
-
- protected:
- /**
- * @brief Print the message of the exception to the passed stream.
- *
- * @param[in] os Stream to print message of the exception to.
- */
- void print_message(std::ostream& os) const override;
- };
-
- }
-
- #include "exception.inl"
|