summaryrefslogtreecommitdiff
path: root/src/mongo/executor
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/executor')
-rw-r--r--src/mongo/executor/network_interface_tl.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/mongo/executor/network_interface_tl.cpp b/src/mongo/executor/network_interface_tl.cpp
index 0f23b2f61d7..9d7a4129ca1 100644
--- a/src/mongo/executor/network_interface_tl.cpp
+++ b/src/mongo/executor/network_interface_tl.cpp
@@ -1021,10 +1021,15 @@ void NetworkInterfaceTL::ExhaustCommandState::continueExhaustRequest(
}
auto onAnyResponse = RemoteCommandOnAnyResponse(requestState->host, response);
- if (!catchingInvoke([&] { doMetadataHook(onAnyResponse); },
- [&](Status& err) { finalResponsePromise.setError(err); },
- "Exhaust command metadata hook readReplyMetadata"))
+ try {
+ doMetadataHook(onAnyResponse);
+ } catch (const DBException& ex) {
+ Status err = ex.toStatus();
+ LOGV2(
+ 9183100, "Exhaust command metadata hook readReplyMetadata failed", "error"_attr = err);
+ finalResponsePromise.setError(err);
return;
+ }
// If the command failed, we will call 'onReply' as a part of the future chain paired with
// the promise. This is to be sure that all error paths will run 'onReply' only once upon
@@ -1037,20 +1042,28 @@ void NetworkInterfaceTL::ExhaustCommandState::continueExhaustRequest(
return;
}
- if (!catchingInvoke([&] { onReplyFn(onAnyResponse); },
- [&](Status& err) { finalResponsePromise.setError(err); },
- "Exhaust command onReplyFn"))
+ try {
+ onReplyFn(onAnyResponse);
+ } catch (const DBException& ex) {
+ Status err = ex.toStatus();
+ LOGV2(9183101, "Exhaust command onReplyFn failed", "error"_attr = err);
+ finalResponsePromise.setError(err);
return;
+ }
// Reset the stopwatch to measure the correct duration for the following reply
stopwatch.restart();
if (deadline != kNoExpirationDate) {
deadline = stopwatch.start() + requestOnAny.timeout;
}
- if (!catchingInvoke([&] { setTimer(); },
- [&](Status& err) { finalResponsePromise.setError(err); },
- "Exhaust command setTimer"))
+ try {
+ setTimer();
+ } catch (const DBException& ex) {
+ Status err = ex.toStatus();
+ LOGV2(9183102, "Exhaust command setTimer failed", "error"_attr = err);
+ finalResponsePromise.setError(err);
return;
+ }
requestState->getClient(requestState->conn)
->awaitExhaustCommand(baton)