Skip to content

Commit a032bb3

Browse files
committed
Define non-resumable error codes in a single array
1 parent 4c6f7ce commit a032bb3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/ChangeStream.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ class ChangeStream implements Iterator
4040
*/
4141
const CURSOR_NOT_FOUND = 43;
4242

43-
private static $errorCodeCappedPositionLost = 136;
44-
private static $errorCodeInterrupted = 11601;
45-
private static $errorCodeCursorKilled = 237;
43+
private static $nonResumableErrorCodes = [
44+
136, // CappedPositionLost
45+
237, // CursorKilled
46+
11601, // Interrupted
47+
];
4648

4749
private $resumeCallable;
4850
private $iterator;
@@ -173,7 +175,7 @@ private function isResumableError(RuntimeException $exception)
173175
return false;
174176
}
175177

176-
if (in_array($exception->getCode(), [self::$errorCodeCappedPositionLost, self::$errorCodeCursorKilled, self::$errorCodeInterrupted])) {
178+
if (in_array($exception->getCode(), self::$nonResumableErrorCodes)) {
177179
return false;
178180
}
179181

0 commit comments

Comments
 (0)