Skip to content

Commit

Permalink
Merge branch 'transactions'
Browse files Browse the repository at this point in the history
  • Loading branch information
jgaa committed Aug 10, 2024
2 parents ead62b2 + a339ac8 commit 2b10922
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
18 changes: 10 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,16 @@ if(NOT DEFINED USE_BOOST_VERSION)
set(USE_BOOST_VERSION 1.83)
endif()

find_package(Boost ${USE_BOOST_VERSION} REQUIRED COMPONENTS
system
context
chrono
json
program_options
${BOOST_LOG_DEP}
)
# find_package(Boost ${USE_BOOST_VERSION} REQUIRED COMPONENTS
# system
# context
# chrono
# json
# program_options
# ${BOOST_LOG_DEP}
# )

find_package(Boost ${USE_BOOST_VERSION} REQUIRED)

if (Boost_VERSION VERSION_GREATER_EQUAL "1.85.0")
find_package(Boost ${USE_BOOST_VERSION} REQUIRED COMPONENTS
Expand Down
10 changes: 5 additions & 5 deletions include/mysqlpool/mysqlpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ struct resolve_failed : public std::runtime_error {
};

/*! Some error occured for a query */
struct db_err : public std::runtime_error {
struct server_err : public std::runtime_error {

db_err(boost::system::error_code ec, std::string message) noexcept
server_err(boost::system::error_code ec, std::string message) noexcept
: std::runtime_error{std::move(message)}, ec_{ec} {}

db_err(boost::system::error_code ec) noexcept
server_err(boost::system::error_code ec) noexcept
: std::runtime_error{ec.message()}, ec_{ec} {}

const boost::system::error_code& error() const noexcept {
Expand All @@ -117,9 +117,9 @@ struct db_err : public std::runtime_error {
};

/*! A query failed because a unique constraint was violated */
struct db_err_exists : public db_err {
struct db_err_exists : public server_err {
db_err_exists(boost::system::error_code ec)
: db_err(ec, ec.message()) {}
: server_err(ec, ec.message()) {}
};

namespace detail {
Expand Down
4 changes: 2 additions & 2 deletions src/mysqlpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,10 @@ bool Mysqlpool::handleError(const boost::system::error_code &ec, boost::mysql::d
return false; // retry
}
MYSQLPOOL_LOG_DEBUG_("The error is recoverable but we will not re-try the query.");
::boost::throw_exception(db_err{ec}, BOOST_CURRENT_LOCATION);
::boost::throw_exception(server_err{ec}, BOOST_CURRENT_LOCATION);
default:
MYSQLPOOL_LOG_DEBUG_("The error is non-recoverable");
::boost::throw_exception(db_err{ec}, BOOST_CURRENT_LOCATION);
::boost::throw_exception(server_err{ec}, BOOST_CURRENT_LOCATION);
}
}
return true;
Expand Down

0 comments on commit 2b10922

Please sign in to comment.