Skip to content

Commit 4b74f81

Browse files
committed
Revise error messages for readConcern and writeConcern in transactions
The transaction spec requires certain language, and this is now expected in spec test for clientBulkWrite.
1 parent ff7b11a commit 4b74f81

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Exception/UnsupportedException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static function hintNotSupported(): self
4747
*/
4848
public static function readConcernNotSupportedInTransaction(): self
4949
{
50-
return new self('The "readConcern" option cannot be specified within a transaction. Instead, specify it when starting the transaction.');
50+
return new self('Cannot set read concern after starting a transaction. Instead, specify the "readConcern" option when starting the transaction.');
5151
}
5252

5353
/**
@@ -57,6 +57,6 @@ public static function readConcernNotSupportedInTransaction(): self
5757
*/
5858
public static function writeConcernNotSupportedInTransaction(): self
5959
{
60-
return new self('The "writeConcern" option cannot be specified within a transaction. Instead, specify it when starting the transaction.');
60+
return new self('Cannot set write concern after starting a transaction. Instead, specify the "writeConcern" option when starting the transaction.');
6161
}
6262
}

tests/Collection/CollectionFunctionalTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ public function testMethodInTransactionWithWriteConcernOption($method): void
718718
$session->startTransaction();
719719

720720
$this->expectException(UnsupportedException::class);
721-
$this->expectExceptionMessage('"writeConcern" option cannot be specified within a transaction');
721+
$this->expectExceptionMessage('Cannot set write concern after starting a transaction');
722722

723723
try {
724724
call_user_func($method, $this->collection, $session, ['writeConcern' => new WriteConcern(1)]);
@@ -738,7 +738,7 @@ public function testMethodInTransactionWithReadConcernOption($method): void
738738
$session->startTransaction();
739739

740740
$this->expectException(UnsupportedException::class);
741-
$this->expectExceptionMessage('"readConcern" option cannot be specified within a transaction');
741+
$this->expectExceptionMessage('Cannot set read concern after starting a transaction');
742742

743743
try {
744744
call_user_func($method, $this->collection, $session, ['readConcern' => new ReadConcern(ReadConcern::LOCAL)]);

0 commit comments

Comments
 (0)