summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/collection_cloner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/repl/collection_cloner.cpp')
-rw-r--r--src/mongo/db/repl/collection_cloner.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mongo/db/repl/collection_cloner.cpp b/src/mongo/db/repl/collection_cloner.cpp
index 036f0b94af0..289941e94e8 100644
--- a/src/mongo/db/repl/collection_cloner.cpp
+++ b/src/mongo/db/repl/collection_cloner.cpp
@@ -144,9 +144,13 @@ CollectionCloner::CollectionCloner(executor::TaskExecutor* executor,
_documentsToInsert(),
_dbWorkTaskRunner(_dbWorkThreadPool),
_scheduleDbWorkFn([this](const executor::TaskExecutor::CallbackFn& work) {
- auto task = [work](OperationContext* opCtx,
- const Status& status) -> TaskRunner::NextAction {
- work(executor::TaskExecutor::CallbackArgs(nullptr, {}, status, opCtx));
+ auto task = [ this, work ](OperationContext * opCtx,
+ const Status& status) noexcept->TaskRunner::NextAction {
+ try {
+ work(executor::TaskExecutor::CallbackArgs(nullptr, {}, status, opCtx));
+ } catch (...) {
+ _finishCallback(exceptionToStatus());
+ }
return TaskRunner::NextAction::kDisposeOperationContext;
};
_dbWorkTaskRunner.schedule(task);