Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lemon-flies-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/firestore': patch
---

Fixes fetch connection error messages that were undefined.
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,21 @@ export class FetchConnection extends RestConnection {
}
response = await fetch(url, fetchArgs);
} catch (e) {
const err = e as { status: number | undefined; statusText: string };
const err = e as {
message?: string;
status?: number;
statusText?: string;
cause?: unknown;
};
const message = err?.message;
const cause = err?.cause ? String(err.cause) : undefined;
const errorMessage =
(message && cause ? `${message} (${cause})` : (message ?? cause)) ??
err?.statusText ??
Comment thread
dlarocque marked this conversation as resolved.
String(e);
Comment thread
dlarocque marked this conversation as resolved.
throw new FirestoreError(
mapCodeFromHttpStatus(err.status),
'Request failed with error: ' + err.statusText
mapCodeFromHttpStatus(err?.status),
`Request failed with error: ${errorMessage}`
);
}

Expand Down
Loading