File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -242,7 +242,7 @@ namespace db {
242242 exit (2 );
243243 }
244244#ifdef DPP_CORO
245- std::thread ([]() {
245+ std::thread ([&bot ]() {
246246 dpp::utility::set_thread_name (" sql/coro" );
247247 while (true ) {
248248 cached_query_results qr;
@@ -260,7 +260,12 @@ namespace db {
260260 if (!qr.format .empty ()) {
261261 auto results = query (qr.format , qr.parameters );
262262 if (qr.callback ) {
263- qr.callback (results);
263+ try {
264+ qr.callback (results);
265+ }
266+ catch (const std::exception& e) {
267+ bot.log (dpp::ll_warning, " Exception in SQL query callback: " + std::string (e.what ()));
268+ }
264269 }
265270 }
266271 }
@@ -549,7 +554,11 @@ namespace db {
549554 thisrow[a] = b;
550555 s_field_count++;
551556 }
552- rv.emplace_back (thisrow);
557+ if (!thisrow.empty ()) {
558+ rv.emplace_back (thisrow);
559+ } else {
560+ log_error (format, " DB: Spurious empty fieldset" );
561+ }
553562 }
554563 }
555564 }
You can’t perform that action at this time.
0 commit comments