Skip to content

Commit

Permalink
增强异常捕获能力
Browse files Browse the repository at this point in the history
  • Loading branch information
super1207 committed Feb 1, 2022
1 parent af2becf commit 45f374c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/MiraiCQ/MiraiCQ/tool/ThreadTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,14 @@ void ThreadTool::add_new_thread()
}
}
/* 执行任务 */
task();
try {
task();
}
catch (const std::exception& e) {
MiraiLog::get_instance()->add_fatal_log("ThreadTool", std::string("在ThreadTool中发生未知错误:") + e.what());
exit(-1);
}

}
--cur_thread_nums;
}).detach();
Expand Down

0 comments on commit 45f374c

Please sign in to comment.