summaryrefslogtreecommitdiff
path: root/src/mongo/db/persistent_task_store.h
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2022-02-23 17:16:31 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-23 18:58:11 +0000
commit23d4be01ca042cd28d0d616f9334e02598e79510 (patch)
treef4ad008c37f1c9f29812f274b9734646c5de7839 /src/mongo/db/persistent_task_store.h
parent5d99bcaa999e8ca595e36642bdd174abe6986929 (diff)
downloadmongo-23d4be01ca042cd28d0d616f9334e02598e79510.tar.gz
SERVER-63331 Convert WriteErrors parsing into IDL
Diffstat (limited to 'src/mongo/db/persistent_task_store.h')
-rw-r--r--src/mongo/db/persistent_task_store.h11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/mongo/db/persistent_task_store.h b/src/mongo/db/persistent_task_store.h
index e34fa209e66..8e59d6ed280 100644
--- a/src/mongo/db/persistent_task_store.h
+++ b/src/mongo/db/persistent_task_store.h
@@ -187,7 +187,7 @@ private:
WriteConcerns::kMajorityWriteConcernShardingTimeout) {
DBDirectClient dbClient(opCtx);
- auto commandResponse = dbClient.update([&] {
+ auto commandResponse = write_ops::checkWriteErrors(dbClient.update([&] {
write_ops::UpdateCommandRequest updateOp(_storageNss);
auto updateModification = write_ops::UpdateModification::parseFromClassicUpdate(update);
write_ops::UpdateOpEntry updateEntry(filter, updateModification);
@@ -195,14 +195,7 @@ private:
updateEntry.setUpsert(upsert);
updateOp.setUpdates({updateEntry});
return updateOp;
- }());
-
- auto writeErrors = commandResponse.getWriteErrors();
- if (writeErrors) {
- BSONObj firstWriteError = writeErrors->front();
- uasserted(ErrorCodes::Error(firstWriteError.getIntField("code")),
- firstWriteError.getStringField("errmsg"));
- }
+ }()));
uassert(ErrorCodes::NoMatchingDocument,
"No matching document found for query {} on namespace {}"_format(