Commit 589a0393 authored by Ronan's avatar Ronan

fix(MainDb): handle exception after reconnect in SafeTransaction

parent 68ce70b0
......@@ -87,13 +87,17 @@ public:
try {
mResult = mFunction();
} catch (const soci::soci_error &e) {
lWarning() << "Catched exception in MainDb::" << info.name << ".";
lWarning() << "Catched exception in MainDb::" << info.name << "(" << e.what() << ").";
soci::soci_error::error_category category = e.get_error_category();
if (
(category == soci::soci_error::connection_error || category == soci::soci_error::unknown) &&
info.mainDb->forceReconnect()
) {
mResult = mFunction();
try {
mResult = mFunction();
} catch (const exception &e) {
lWarning() << "Unable to execute query after reconnect in MainDb::" << info.name << "(" << e.what() << ").";
}
return;
}
lError() << "Unhandled [" << getErrorCategoryAsString(category) << "] exception in MainDb::" <<
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment