Skip to content

Commit a90739a

Browse files
committed
refactor: address pr comments
1 parent 9cd5fcf commit a90739a

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

packages/e2e-tests/test/e2e.spec.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -737,13 +737,10 @@ describe('e2e', function () {
737737

738738
it('throws the .toArray() suggestion when a user attempts to serialize a cursor', async function () {
739739
await shell.executeLine('const b = db.test.find()');
740-
await shell.executeLine('b.b = b');
741740
await shell.executeLine('console.log(JSON.stringify(b));');
742-
await eventually(() => {
743-
shell.assertContainsOutput(
744-
'Error serializing a cursor. Did you mean to call .toArray() first?'
745-
);
746-
});
741+
shell.assertContainsOutput(
742+
'Cannot serialize a cursor to JSON. Did you mean to call .toArray() first?'
743+
);
747744
});
748745

749746
it('expands explain output from aggregation indefinitely', async function () {

packages/shell-api/src/cursor.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ describe('Cursor', function () {
809809
} catch (e: any) {
810810
expect(e).to.be.instanceOf(MongoshInvalidInputError);
811811
expect(e.message).to.contain(
812-
'Error serializing a cursor. Did you mean to call .toArray() first?'
812+
'Cannot serialize a cursor to JSON. Did you mean to call .toArray() first?'
813813
);
814814
expect(e.code).to.equal(CommonErrors.InvalidArgument);
815815
}

packages/shell-api/src/cursor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default class Cursor extends AggregateOrFindCursor<ServiceProviderFindCur
4444
*/
4545
toJSON(): void {
4646
throw new MongoshInvalidInputError(
47-
'Error serializing a cursor. Did you mean to call .toArray() first?',
47+
'Cannot serialize a cursor to JSON. Did you mean to call .toArray() first?',
4848
CommonErrors.InvalidArgument
4949
);
5050
}

0 commit comments

Comments
 (0)