File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4456,7 +4456,7 @@ public function updateDocuments(
44564456 try {
44574457 $ onNext && $ onNext ($ doc );
44584458 } catch (Exception $ e ) {
4459- $ onError && $ onError ($ e );
4459+ $ onError ? $ onError ($ e ) : throw $ e ;
44604460 }
44614461 $ modified ++;
44624462 }
Original file line number Diff line number Diff line change @@ -3550,6 +3550,23 @@ public function testUpdateDocuments(): void
35503550
35513551 // Test Update half of the documents
35523552 $ results = [];
3553+ try {
3554+ $ count = $ database ->updateDocuments ($ collection , new Document ([
3555+ 'string ' => 'text📝 updated ' ,
3556+ ]), [
3557+ Query::lessThan ('integer ' , -1 ),
3558+ ], onNext: function ($ doc ) use (&$ results ) {
3559+ $ results [] = $ doc ;
3560+ throw new Exception ("Error thrown to test update doesn't stopped and error is caught " );
3561+ });
3562+ } catch (Exception $ e ) {
3563+ if ($ e instanceof Exception) {
3564+ $ this ->assertInstanceOf (Exception::class, $ e );
3565+ $ this ->assertEquals ("Error thrown to test that deletion doesn't stop and error is caught " , $ e ->getMessage ());
3566+ } else {
3567+ $ this ->fail ("Caught value is not an Exception. " );
3568+ }
3569+ }
35533570 $ count = $ database ->updateDocuments ($ collection , new Document ([
35543571 'string ' => 'text📝 updated ' ,
35553572 ]), [
You can’t perform that action at this time.
0 commit comments