lib/mongo/collection/view/change_stream.rb in mongo-2.18.3 vs lib/mongo/collection/view/change_stream.rb in mongo-2.19.0

- old
+ new

@@ -1,7 +1,7 @@ # frozen_string_literal: true -# encoding: utf-8 +# rubocop:todo all # Copyright (C) 2017-2020 MongoDB Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -162,11 +162,11 @@ raise StopIteration.new if closed? loop do document = try_next yield document if document end - rescue StopIteration => e + rescue StopIteration return self end # Return one document from the change stream, if one is available. # @@ -236,10 +236,10 @@ # @since 2.5.0 def close unless closed? begin @cursor.close - rescue Error::OperationFailure, Error::SocketError, Error::SocketTimeoutError + rescue Error::OperationFailure, Error::SocketError, Error::SocketTimeoutError, Error::MissingConnection # ignore end @cursor = nil end end