Skip to content

Commit

Permalink
fix: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
greg6775 committed Dec 17, 2023
1 parent f4ba171 commit 1758c7e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/protocol/protocol.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {
Document,
} from "../../deps.ts";
import { Document } from "../../deps.ts";
import {
MongoDriverError,
MongoErrorInfo,
Expand Down Expand Up @@ -109,12 +107,16 @@ export class WireProtocol {
this.#isPendingResponse = true;
while (this.#pendingResponses.size > 0) {
const headerBuffer = await this.#reader.read(new Uint8Array(16));
if (!headerBuffer.value) throw new MongoDriverError("Invalid response header");
if (!headerBuffer.value) {
throw new MongoDriverError("Invalid response header");
}
const header = parseHeader(headerBuffer.value);
const bodyBuffer = await this.#reader.read(
new Uint8Array(header.messageLength - 16),
);
if (!bodyBuffer.value) throw new MongoDriverError("Invalid response body");
if (!bodyBuffer.value) {
throw new MongoDriverError("Invalid response body");
}
const reply = deserializeMessage(header, bodyBuffer.value);
const pendingMessage = this.#pendingResponses.get(header.responseTo);
this.#pendingResponses.delete(header.responseTo);
Expand Down

0 comments on commit 1758c7e

Please sign in to comment.