Skip to content

Commit

Permalink
DRIVERS-2695 Correct the error propagation logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
qingyang-hu committed Oct 16, 2023
1 parent a70f3c8 commit efc2bfc
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions source/retryable-writes/retryable-writes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ The above rules are implemented in the following pseudo-code:
retryableCommand = addTransactionIdToCommand(command, session);
Exception previousError = null;
retrying = false;
while true {
try {
return executeCommand(server, retryableCommand);
Expand Down Expand Up @@ -519,23 +520,15 @@ The above rules are implemented in the following pseudo-code:
if (timeoutMS == null) {
/* If CSOT is not enabled, allow any retryable error from the second
* attempt to propagate to our caller, as it will be just as relevant
* (if not more relevant) than the original error. For exceptions that
* originate from the driver, we should raise the previous error. Other
* exceptions originating from the server should be allowed to
* propagate. */
try {
return executeCommand(server, retryableCommand);
} catch (DriverException ignoredError) {
* (if not more relevant) than the original error. */
if (retrying) {
throw previousError;
} catch (Exception secondError) {
handleError(secondError);
throw secondError;
}
break
} else if (isExpired(timeoutMS)) {
/* CSOT is enabled and the operation has timed out. */
throw previousError;
}
retrying = true;
}
}
Expand Down

0 comments on commit efc2bfc

Please sign in to comment.