Commit a032bb3f authored by Jeremy Mikola's avatar Jeremy Mikola

Define non-resumable error codes in a single array

parent 4c6f7ceb
......@@ -40,9 +40,11 @@ class ChangeStream implements Iterator
*/
const CURSOR_NOT_FOUND = 43;
private static $errorCodeCappedPositionLost = 136;
private static $errorCodeInterrupted = 11601;
private static $errorCodeCursorKilled = 237;
private static $nonResumableErrorCodes = [
136, // CappedPositionLost
237, // CursorKilled
11601, // Interrupted
];
private $resumeCallable;
private $iterator;
......@@ -173,7 +175,7 @@ class ChangeStream implements Iterator
return false;
}
if (in_array($exception->getCode(), [self::$errorCodeCappedPositionLost, self::$errorCodeCursorKilled, self::$errorCodeInterrupted])) {
if (in_array($exception->getCode(), self::$nonResumableErrorCodes)) {
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment