1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #ifndef BOOST_MYSQL_ERROR_WITH_DIAGNOSTICS_HPP
- #define BOOST_MYSQL_ERROR_WITH_DIAGNOSTICS_HPP
- #include <boost/mysql/diagnostics.hpp>
- #include <boost/mysql/error_code.hpp>
- #include <boost/system/system_error.hpp>
- namespace boost {
- namespace mysql {
- class error_with_diagnostics : public system::system_error
- {
- diagnostics diag_;
- static system::system_error create_base(const error_code& err, const diagnostics& diag)
- {
- return diag.client_message().empty() ? system::system_error(err)
- : system::system_error(err, diag.client_message());
- }
- public:
-
- error_with_diagnostics(const error_code& err, const diagnostics& diag)
- : system::system_error(create_base(err, diag)), diag_(diag)
- {
- }
-
- const diagnostics& get_diagnostics() const noexcept { return diag_; }
- };
- }
- }
- #endif
|