Skip to content

Commit

Permalink
code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dariakp committed Jun 8, 2021
1 parent cc145dd commit ed91110
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/bulk/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ function handleMongoWriteConcernError(
) {
mergeBatchResults(batch, bulkResult, undefined, err.result);

// TODO: make more reasonable
// TODO: Remove multiple levels of wrapping (NODE-3337)
const wrappedWriteConcernError = new WriteConcernError(
new MongoServerError({
errmsg: err.result?.writeConcernError.errmsg,
Expand Down
1 change: 1 addition & 0 deletions src/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,7 @@ export class Collection<TSchema extends Document = Document> {
): Promise<Document | Document[]> | void {
if ('function' === typeof options) (callback = options), (options = {});
// Out must always be defined (make sure we don't break weirdly on pre 1.8+ servers)
// TODO NODE-3339: Figure out if this is still necessary given we no longer officially support pre-1.8
if (options?.out == null) {
throw new MongoDriverError(
'the out option parameter must be defined, see mongodb docs for possible values'
Expand Down
6 changes: 2 additions & 4 deletions src/gridfs-stream/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,7 @@ export class GridFSBucketReadStream extends Readable {

function throwIfInitialized(stream: GridFSBucketReadStream): void {
if (stream.s.init) {
throw new MongoDriverError(
'You cannot change options after the stream has entered flowing mode!'
);
throw new MongoDriverError('Options cannot be changed after the stream is initialized');
}
}

Expand Down Expand Up @@ -316,7 +314,7 @@ function init(stream: GridFSBucketReadStream): void {
: stream.s.filter.filename;
const errmsg = 'FileNotFound: file ' + identifier + ' was not found';
const err = new MongoDriverError(errmsg);
err.code = 'ENOENT';
err.code = 'ENOENT'; // TODO: NODE-3338 set property as part of constructor
return __handleError(stream, err);
}

Expand Down
2 changes: 1 addition & 1 deletion src/operations/eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class EvalOperation extends CommandOperation<Document> {
}

if (result) {
callback(new MongoServerError({ message: `eval failed: ${result.errmsg}`, driver: true }));
callback(new MongoServerError({ message: `eval failed: ${result.errmsg}` }));
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ function applySession(
): MongoDriverError | undefined {
// TODO: merge this with `assertAlive`, did not want to throw a try/catch here
if (session.hasEnded) {
return new MongoDriverError('Attemped to use a session that has ended');
return new MongoDriverError('Attempted to use a session that has ended');
}

const serverSession = session.serverSession;
Expand Down

0 comments on commit ed91110

Please sign in to comment.