Skip to content

Commit 2b2f64c

Browse files
made MongoServerError.errorResponse required + casted resulting type errors
1 parent 8e33665 commit 2b2f64c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Diff for: src/error.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ export class MongoError extends Error {
201201
*/
202202
export class MongoServerError extends MongoError {
203203
/** Raw error result document returned by server. */
204-
errorResponse?: ErrorDescription;
204+
errorResponse: ErrorDescription;
205205
codeName?: string;
206206
writeConcernError?: Document;
207207
errInfo?: Document;

Diff for: src/sdam/server.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export class Server extends TypedEventEmitter<ServerEvents> {
171171
this.monitor.on(event, (e: any) => this.emit(event, e));
172172
}
173173

174-
this.monitor.on('resetServer', (error: MongoError) => markServerUnknown(this, error));
174+
this.monitor.on('resetServer', (error: MongoServerError) => markServerUnknown(this, error));
175175
this.monitor.on(Server.SERVER_HEARTBEAT_SUCCEEDED, (event: ServerHeartbeatSucceededEvent) => {
176176
this.emit(
177177
Server.DESCRIPTION_RECEIVED,
@@ -369,7 +369,7 @@ export class Server extends TypedEventEmitter<ServerEvents> {
369369
// clear for the specific service id.
370370
if (!this.loadBalanced) {
371371
error.addErrorLabel(MongoErrorLabel.ResetPool);
372-
markServerUnknown(this, error);
372+
markServerUnknown(this, error as MongoServerError);
373373
} else if (connection) {
374374
this.pool.clear({ serviceId: connection.serviceId });
375375
}
@@ -385,7 +385,7 @@ export class Server extends TypedEventEmitter<ServerEvents> {
385385
if (shouldClearPool) {
386386
error.addErrorLabel(MongoErrorLabel.ResetPool);
387387
}
388-
markServerUnknown(this, error);
388+
markServerUnknown(this, error as MongoServerError);
389389
process.nextTick(() => this.requestCheck());
390390
}
391391
}

Diff for: src/sdam/topology_description.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ export class TopologyDescription {
313313
);
314314

315315
if (descriptionsWithError.length > 0) {
316-
return descriptionsWithError[0].error;
316+
return descriptionsWithError[0].error as MongoServerError;
317317
}
318318

319319
return null;

0 commit comments

Comments
 (0)