Skip to content

Commit a869466

Browse files
committed
Fix payload printing.
1 parent 6d9d5cd commit a869466

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

packages/firestore/src/util/bundle_reader.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
BundleMetadata
2121
} from '../protos/firestore_bundle_proto';
2222
import { Deferred } from './promise';
23-
import { AsyncQueue } from './async_queue';
2423

2524
/**
2625
* A complete element in the bundle stream, together with the byte length it
@@ -101,10 +100,9 @@ export class BundleReader {
101100
if (element && element.isBundleMetadata()) {
102101
this.metadata.resolve(element.payload.metadata!);
103102
} else {
104-
const payload = (element || { payload: null }).payload;
105103
this.metadata.reject(
106104
new Error(`The first element of the bundle is not a metadata, it is
107-
${JSON.stringify(payload)}`)
105+
${JSON.stringify(element?.payload)}`)
108106
);
109107
}
110108
},
@@ -172,8 +170,7 @@ export class BundleReader {
172170
* If reached end of the stream, returns a null.
173171
*/
174172
private async readLength(): Promise<Uint8Array | null> {
175-
let position: number;
176-
while ((position = this.indexOfOpenBracket()) < 0) {
173+
while (this.indexOfOpenBracket() < 0) {
177174
const done = await this.pullMoreDataToBuffer();
178175
if (done) {
179176
break;
@@ -186,7 +183,7 @@ export class BundleReader {
186183
return null;
187184
}
188185

189-
position = this.indexOfOpenBracket();
186+
const position = this.indexOfOpenBracket();
190187
// Broke out of the loop because underlying stream is closed, but still
191188
// cannot find an open bracket.
192189
if (position < 0) {

0 commit comments

Comments
 (0)